Program: 189334
Project: 189334
Buggy source:
/** 
 * Test all the various sort ordering for filter searches on submissions.
 */
@Test public void testSubmissionFilterSearchOrdering() throws IOException, InterruptedException {
  Person otherPerson=personRepo.createPerson("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",RoleType.REVIEWER).save();
  EmbargoType e1=settingRepo.createEmbargoType("String_Node_Str","String_Node_Str",null,true);
  e1.setDisplayOrder(100);
  e1.save();
  EmbargoType e2=settingRepo.createEmbargoType("String_Node_Str","String_Node_Str",null,true);
  e2.setDisplayOrder(10);
  e2.save();
  CustomActionDefinition def=settingRepo.createCustomActionDefinition("String_Node_Str",false).save();
  File file1=File.createTempFile("String_Node_Str","String_Node_Str");
  File file2=File.createTempFile("String_Node_Str","String_Node_Str");
  FileUtils.writeStringToFile(file1,"String_Node_Str");
  FileUtils.writeStringToFile(file2,"String_Node_Str");
  Submission sub1=subRepo.createSubmission(person);
  createSubmission(sub1,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",2012,5,true);
  sub1.setAssignee(otherPerson);
  sub1.setDocumentLanguage("String_Node_Str");
  sub1.addDocumentSubject("String_Node_Str");
  sub1.setPublishedMaterial("String_Node_Str");
  sub1.addEmbargoType(e1);
  sub1.setDocumentType("String_Node_Str");
  sub1.addAttachment(file1,AttachmentType.SUPPLEMENTAL);
  sub1.addCommitteeMember("String_Node_Str","String_Node_Str","String_Node_Str");
  sub1.addCommitteeMember("String_Node_Str","String_Node_Str","String_Node_Str");
  sub1.setDefenseDate(new Date(2012,5,1));
  sub1.setSubmissionDate(new Date(2012,5,1));
  sub1.setApprovalDate(new Date(2012,5,1));
  sub1.setLicenseAgreementDate(new Date(2012,5,1));
  sub1.setCommitteeApprovalDate(new Date(2012,5,1));
  sub1.setCommitteeEmbargoApprovalDate(new Date(2012,5,1));
  sub1.setDepositId("String_Node_Str");
  sub1.setReviewerNotes("String_Node_Str");
  sub1.addCustomAction(def,true);
  sub1.setOrcid("String_Node_Str");
  sub1.save();
  Submission sub2=subRepo.createSubmission(otherPerson);
  createSubmission(sub2,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",2005,4,null);
  sub2.setDocumentLanguage("String_Node_Str");
  sub2.addDocumentSubject("String_Node_Str");
  sub2.setPublishedMaterial("String_Node_Str");
  sub2.setAssignee(person);
  sub2.addEmbargoType(e2);
  sub2.setDocumentType("String_Node_Str");
  sub2.addAttachment(file2,AttachmentType.PRIMARY);
  sub2.addAttachment(file1,AttachmentType.SUPPLEMENTAL);
  sub2.addCommitteeMember("String_Node_Str","String_Node_Str","String_Node_Str");
  sub2.setDefenseDate(new Date(2005,5,1));
  sub2.setSubmissionDate(new Date(2005,5,1));
  sub2.setApprovalDate(new Date(2005,5,1));
  sub2.setLicenseAgreementDate(new Date(2005,5,1));
  sub2.setCommitteeApprovalDate(new Date(2002,5,1));
  sub2.setCommitteeEmbargoApprovalDate(new Date(2002,5,1));
  sub2.setDepositId("String_Node_Str");
  sub2.setReviewerNotes("String_Node_Str");
  sub2.setOrcid("String_Node_Str");
  sub2.save();
  JPA.em().getTransaction().commit();
  JPA.em().getTransaction().begin();
  Thread.sleep(100);
  indexer.rebuild(true);
  assertFalse(indexer.isJobRunning());
  NamedSearchFilter filter=subRepo.createSearchFilter(person,"String_Node_Str");
  filter.addSearchText("String_Node_Str");
  filter.save();
  List<Submission> submissions;
  try {
    submissions=searcher.submissionSearch(filter,SearchOrder.ID,SearchDirection.DESCENDING,0,20).getResults();
    assertTrue(submissions.contains(sub1));
    assertTrue(submissions.contains(sub2));
    assertTrue(submissions.indexOf(sub2) < submissions.indexOf(sub1));
    submissions=searcher.submissionSearch(filter,SearchOrder.STUDENT_NAME,SearchDirection.DESCENDING,0,20).getResults();
    assertTrue(submissions.contains(sub1));
    assertTrue(submissions.contains(sub2));
    assertTrue(submissions.indexOf(sub2) < submissions.indexOf(sub1));
    submissions=searcher.submissionSearch(filter,SearchOrder.DOCUMENT_TITLE,SearchDirection.DESCENDING,0,20).getResults();
    assertTrue(submissions.contains(sub1));
    assertTrue(submissions.contains(sub2));
    assertTrue(submissions.indexOf(sub1) < submissions.indexOf(sub2));
    submissions=searcher.submissionSearch(filter,SearchOrder.DOCUMENT_ABSTRACT,SearchDirection.DESCENDING,0,20).getResults();
    assertTrue(submissions.contains(sub1));
    assertTrue(submissions.contains(sub2));
    assertTrue(submissions.indexOf(sub1) < submissions.indexOf(sub2));
    submissions=searcher.submissionSearch(filter,SearchOrder.DOCUMENT_KEYWORDS,SearchDirection.DESCENDING,0,20).getResults();
    assertTrue(submissions.contains(sub1));
    assertTrue(submissions.contains(sub2));
    assertTrue(submissions.indexOf(sub1) < submissions.indexOf(sub2));
    submissions=searcher.submissionSearch(filter,SearchOrder.DOCUMENT_SUBJECTS,SearchDirection.DESCENDING,0,20).getResults();
    assertTrue(submissions.contains(sub1));
    assertTrue(submissions.contains(sub2));
    assertTrue(submissions.indexOf(sub1) < submissions.indexOf(sub2));
    submissions=searcher.submissionSearch(filter,SearchOrder.DOCUMENT_LANGUAGE,SearchDirection.DESCENDING,0,20).getResults();
    assertTrue(submissions.contains(sub1));
    assertTrue(submissions.contains(sub2));
    assertTrue(submissions.indexOf(sub1) < submissions.indexOf(sub2));
    submissions=searcher.submissionSearch(filter,SearchOrder.PUBLISHED_MATERIAL,SearchDirection.DESCENDING,0,20).getResults();
    assertTrue(submissions.contains(sub1));
    assertTrue(submissions.contains(sub2));
    assertTrue(submissions.indexOf(sub1) < submissions.indexOf(sub2));
    submissions=searcher.submissionSearch(filter,SearchOrder.EMBARGO_TYPE,SearchDirection.DESCENDING,0,20).getResults();
    assertTrue(submissions.contains(sub1));
    assertTrue(submissions.contains(sub2));
    assertTrue(submissions.indexOf(sub2) < submissions.indexOf(sub1));
    submissions=searcher.submissionSearch(filter,SearchOrder.PRIMARY_DOCUMENT,SearchDirection.DESCENDING,0,20).getResults();
    assertTrue(submissions.contains(sub1));
    assertTrue(submissions.contains(sub2));
    assertTrue(submissions.indexOf(sub2) < submissions.indexOf(sub1));
    submissions=searcher.submissionSearch(filter,SearchOrder.COMMITTEE_MEMBERS,SearchDirection.DESCENDING,0,20).getResults();
    assertTrue(submissions.contains(sub1));
    assertTrue(submissions.contains(sub2));
    assertTrue(submissions.indexOf(sub1) < submissions.indexOf(sub2));
    submissions=searcher.submissionSearch(filter,SearchOrder.COMMITTEE_CONTACT_EMAIL,SearchDirection.DESCENDING,0,20).getResults();
    assertTrue(submissions.contains(sub1));
    assertTrue(submissions.contains(sub2));
    assertTrue(submissions.indexOf(sub1) < submissions.indexOf(sub2));
    submissions=searcher.submissionSearch(filter,SearchOrder.COMMITTEE_APPROVAL_DATE,SearchDirection.DESCENDING,0,20).getResults();
    assertTrue(submissions.contains(sub1));
    assertTrue(submissions.contains(sub2));
    assertTrue(submissions.indexOf(sub1) < submissions.indexOf(sub2));
    submissions=searcher.submissionSearch(filter,SearchOrder.COMMITTEE_APPROVAL_DATE,SearchDirection.DESCENDING,0,20).getResults();
    assertTrue(submissions.contains(sub1));
    assertTrue(submissions.contains(sub2));
    assertTrue(submissions.indexOf(sub1) < submissions.indexOf(sub2));
    submissions=searcher.submissionSearch(filter,SearchOrder.SUBMISSION_DATE,SearchDirection.DESCENDING,0,20).getResults();
    assertTrue(submissions.contains(sub1));
    assertTrue(submissions.contains(sub2));
    assertTrue(submissions.indexOf(sub1) < submissions.indexOf(sub2));
    submissions=searcher.submissionSearch(filter,SearchOrder.APPROVAL_DATE,SearchDirection.DESCENDING,0,20).getResults();
    assertTrue(submissions.contains(sub1));
    assertTrue(submissions.contains(sub2));
    assertTrue(submissions.indexOf(sub1) < submissions.indexOf(sub2));
    submissions=searcher.submissionSearch(filter,SearchOrder.LICENSE_AGREEMENT_DATE,SearchDirection.DESCENDING,0,20).getResults();
    assertTrue(submissions.contains(sub1));
    assertTrue(submissions.contains(sub2));
    assertTrue(submissions.indexOf(sub1) < submissions.indexOf(sub2));
    submissions=searcher.submissionSearch(filter,SearchOrder.DEGREE,SearchDirection.DESCENDING,0,20).getResults();
    assertTrue(submissions.contains(sub1));
    assertTrue(submissions.contains(sub2));
    assertTrue(submissions.indexOf(sub1) < submissions.indexOf(sub2));
    submissions=searcher.submissionSearch(filter,SearchOrder.DEPARTMENT,SearchDirection.DESCENDING,0,20).getResults();
    assertTrue(submissions.contains(sub1));
    assertTrue(submissions.contains(sub2));
    assertTrue(submissions.indexOf(sub1) < submissions.indexOf(sub2));
    submissions=searcher.submissionSearch(filter,SearchOrder.COLLEGE,SearchDirection.DESCENDING,0,20).getResults();
    assertTrue(submissions.contains(sub1));
    assertTrue(submissions.contains(sub2));
    assertTrue(submissions.indexOf(sub1) < submissions.indexOf(sub2));
    submissions=searcher.submissionSearch(filter,SearchOrder.COLLEGE,SearchDirection.DESCENDING,0,20).getResults();
    assertTrue(submissions.contains(sub1));
    assertTrue(submissions.contains(sub2));
    assertTrue(submissions.indexOf(sub1) < submissions.indexOf(sub2));
    submissions=searcher.submissionSearch(filter,SearchOrder.MAJOR,SearchDirection.DESCENDING,0,20).getResults();
    assertTrue(submissions.contains(sub1));
    assertTrue(submissions.contains(sub2));
    assertTrue(submissions.indexOf(sub1) < submissions.indexOf(sub2));
    submissions=searcher.submissionSearch(filter,SearchOrder.DOCUMENT_TYPE,SearchDirection.DESCENDING,0,20).getResults();
    assertTrue(submissions.contains(sub1));
    assertTrue(submissions.contains(sub2));
    assertTrue(submissions.indexOf(sub1) < submissions.indexOf(sub2));
    submissions=searcher.submissionSearch(filter,SearchOrder.GRADUATION_DATE,SearchDirection.DESCENDING,0,20).getResults();
    assertTrue(submissions.contains(sub1));
    assertTrue(submissions.contains(sub2));
    assertTrue(submissions.indexOf(sub1) < submissions.indexOf(sub2));
    submissions=searcher.submissionSearch(filter,SearchOrder.DEFENSE_DATE,SearchDirection.DESCENDING,0,20).getResults();
    assertTrue(submissions.contains(sub1));
    assertTrue(submissions.contains(sub2));
    assertTrue(submissions.indexOf(sub1) < submissions.indexOf(sub2));
    submissions=searcher.submissionSearch(filter,SearchOrder.STATE,SearchDirection.DESCENDING,0,20).getResults();
    assertTrue(submissions.contains(sub1));
    assertTrue(submissions.contains(sub2));
    assertTrue(submissions.indexOf(sub2) < submissions.indexOf(sub1));
    submissions=searcher.submissionSearch(filter,SearchOrder.GRADUATION_DATE,SearchDirection.DESCENDING,0,20).getResults();
    assertTrue(submissions.contains(sub1));
    assertTrue(submissions.contains(sub2));
    assertTrue(submissions.indexOf(sub1) < submissions.indexOf(sub2));
    submissions=searcher.submissionSearch(filter,SearchOrder.UMI_RELEASE,SearchDirection.DESCENDING,0,20).getResults();
    assertTrue(submissions.contains(sub1));
    assertTrue(submissions.contains(sub2));
    assertTrue(submissions.indexOf(sub1) < submissions.indexOf(sub2));
    submissions=searcher.submissionSearch(filter,SearchOrder.DEPOSIT_ID,SearchDirection.DESCENDING,0,20).getResults();
    assertTrue(submissions.contains(sub1));
    assertTrue(submissions.contains(sub2));
    assertTrue(submissions.indexOf(sub1) < submissions.indexOf(sub2));
    submissions=searcher.submissionSearch(filter,SearchOrder.REVIEWER_NOTES,SearchDirection.DESCENDING,0,20).getResults();
    assertTrue(submissions.contains(sub1));
    assertTrue(submissions.contains(sub2));
    assertTrue(submissions.indexOf(sub1) < submissions.indexOf(sub2));
    submissions=searcher.submissionSearch(filter,SearchOrder.LAST_EVENT_ENTRY,SearchDirection.DESCENDING,0,20).getResults();
    assertTrue(submissions.contains(sub1));
    assertTrue(submissions.contains(sub2));
    assertTrue(submissions.indexOf(sub1) < submissions.indexOf(sub2));
    submissions=searcher.submissionSearch(filter,SearchOrder.LAST_EVENT_TIME,SearchDirection.DESCENDING,0,20).getResults();
    assertTrue(submissions.contains(sub1));
    assertTrue(submissions.contains(sub2));
    assertTrue(submissions.indexOf(sub2) < submissions.indexOf(sub1));
    submissions=searcher.submissionSearch(filter,SearchOrder.ORCID,SearchDirection.DESCENDING,0,20).getResults();
    assertTrue(submissions.contains(sub1));
    assertTrue(submissions.contains(sub2));
    assertTrue(submissions.indexOf(sub1) < submissions.indexOf(sub2));
  }
  finally {
    filter.delete();
    subRepo.findSubmission(sub1.getId()).delete();
    subRepo.findSubmission(sub2.getId()).delete();
    file1.delete();
    file2.delete();
    settingRepo.findEmbargoType(e1.getId()).delete();
    settingRepo.findEmbargoType(e2.getId()).delete();
    settingRepo.findCustomActionDefinition(def.getId()).delete();
    personRepo.findPerson(otherPerson.getId()).delete();
  }
}

Fixed version (ground truth):
/** 
 * Test all the various sort ordering for filter searches on submissions.
 */
@Test public void testSubmissionFilterSearchOrdering() throws IOException, InterruptedException {
  Person otherPerson=personRepo.createPerson("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",RoleType.REVIEWER);
  otherPerson.setOrcid("String_Node_Str");
  otherPerson.save();
  EmbargoType e1=settingRepo.createEmbargoType("String_Node_Str","String_Node_Str",null,true);
  e1.setDisplayOrder(100);
  e1.save();
  EmbargoType e2=settingRepo.createEmbargoType("String_Node_Str","String_Node_Str",null,true);
  e2.setDisplayOrder(10);
  e2.save();
  CustomActionDefinition def=settingRepo.createCustomActionDefinition("String_Node_Str",false).save();
  File file1=File.createTempFile("String_Node_Str","String_Node_Str");
  File file2=File.createTempFile("String_Node_Str","String_Node_Str");
  FileUtils.writeStringToFile(file1,"String_Node_Str");
  FileUtils.writeStringToFile(file2,"String_Node_Str");
  Submission sub1=subRepo.createSubmission(person);
  createSubmission(sub1,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",2012,5,true);
  sub1.setAssignee(otherPerson);
  sub1.setDocumentLanguage("String_Node_Str");
  sub1.addDocumentSubject("String_Node_Str");
  sub1.setPublishedMaterial("String_Node_Str");
  sub1.addEmbargoType(e1);
  sub1.setDocumentType("String_Node_Str");
  sub1.addAttachment(file1,AttachmentType.SUPPLEMENTAL);
  sub1.addCommitteeMember("String_Node_Str","String_Node_Str","String_Node_Str");
  sub1.addCommitteeMember("String_Node_Str","String_Node_Str","String_Node_Str");
  sub1.setDefenseDate(new Date(2012,5,1));
  sub1.setSubmissionDate(new Date(2012,5,1));
  sub1.setApprovalDate(new Date(2012,5,1));
  sub1.setLicenseAgreementDate(new Date(2012,5,1));
  sub1.setCommitteeApprovalDate(new Date(2012,5,1));
  sub1.setCommitteeEmbargoApprovalDate(new Date(2012,5,1));
  sub1.setDepositId("String_Node_Str");
  sub1.setReviewerNotes("String_Node_Str");
  sub1.addCustomAction(def,true);
  sub1.save();
  Submission sub2=subRepo.createSubmission(otherPerson);
  createSubmission(sub2,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",2005,4,null);
  sub2.setDocumentLanguage("String_Node_Str");
  sub2.addDocumentSubject("String_Node_Str");
  sub2.setPublishedMaterial("String_Node_Str");
  sub2.setAssignee(person);
  sub2.addEmbargoType(e2);
  sub2.setDocumentType("String_Node_Str");
  sub2.addAttachment(file2,AttachmentType.PRIMARY);
  sub2.addAttachment(file1,AttachmentType.SUPPLEMENTAL);
  sub2.addCommitteeMember("String_Node_Str","String_Node_Str","String_Node_Str");
  sub2.setDefenseDate(new Date(2005,5,1));
  sub2.setSubmissionDate(new Date(2005,5,1));
  sub2.setApprovalDate(new Date(2005,5,1));
  sub2.setLicenseAgreementDate(new Date(2005,5,1));
  sub2.setCommitteeApprovalDate(new Date(2002,5,1));
  sub2.setCommitteeEmbargoApprovalDate(new Date(2002,5,1));
  sub2.setDepositId("String_Node_Str");
  sub2.setReviewerNotes("String_Node_Str");
  sub2.save();
  JPA.em().getTransaction().commit();
  JPA.em().getTransaction().begin();
  Thread.sleep(100);
  indexer.rebuild(true);
  assertFalse(indexer.isJobRunning());
  NamedSearchFilter filter=subRepo.createSearchFilter(person,"String_Node_Str");
  filter.addSearchText("String_Node_Str");
  filter.save();
  List<Submission> submissions;
  try {
    submissions=searcher.submissionSearch(filter,SearchOrder.ID,SearchDirection.DESCENDING,0,20).getResults();
    assertTrue(submissions.contains(sub1));
    assertTrue(submissions.contains(sub2));
    assertTrue(submissions.indexOf(sub2) < submissions.indexOf(sub1));
    submissions=searcher.submissionSearch(filter,SearchOrder.STUDENT_NAME,SearchDirection.DESCENDING,0,20).getResults();
    assertTrue(submissions.contains(sub1));
    assertTrue(submissions.contains(sub2));
    assertTrue(submissions.indexOf(sub2) < submissions.indexOf(sub1));
    submissions=searcher.submissionSearch(filter,SearchOrder.DOCUMENT_TITLE,SearchDirection.DESCENDING,0,20).getResults();
    assertTrue(submissions.contains(sub1));
    assertTrue(submissions.contains(sub2));
    assertTrue(submissions.indexOf(sub1) < submissions.indexOf(sub2));
    submissions=searcher.submissionSearch(filter,SearchOrder.DOCUMENT_ABSTRACT,SearchDirection.DESCENDING,0,20).getResults();
    assertTrue(submissions.contains(sub1));
    assertTrue(submissions.contains(sub2));
    assertTrue(submissions.indexOf(sub1) < submissions.indexOf(sub2));
    submissions=searcher.submissionSearch(filter,SearchOrder.DOCUMENT_KEYWORDS,SearchDirection.DESCENDING,0,20).getResults();
    assertTrue(submissions.contains(sub1));
    assertTrue(submissions.contains(sub2));
    assertTrue(submissions.indexOf(sub1) < submissions.indexOf(sub2));
    submissions=searcher.submissionSearch(filter,SearchOrder.DOCUMENT_SUBJECTS,SearchDirection.DESCENDING,0,20).getResults();
    assertTrue(submissions.contains(sub1));
    assertTrue(submissions.contains(sub2));
    assertTrue(submissions.indexOf(sub1) < submissions.indexOf(sub2));
    submissions=searcher.submissionSearch(filter,SearchOrder.DOCUMENT_LANGUAGE,SearchDirection.DESCENDING,0,20).getResults();
    assertTrue(submissions.contains(sub1));
    assertTrue(submissions.contains(sub2));
    assertTrue(submissions.indexOf(sub1) < submissions.indexOf(sub2));
    submissions=searcher.submissionSearch(filter,SearchOrder.PUBLISHED_MATERIAL,SearchDirection.DESCENDING,0,20).getResults();
    assertTrue(submissions.contains(sub1));
    assertTrue(submissions.contains(sub2));
    assertTrue(submissions.indexOf(sub1) < submissions.indexOf(sub2));
    submissions=searcher.submissionSearch(filter,SearchOrder.EMBARGO_TYPE,SearchDirection.DESCENDING,0,20).getResults();
    assertTrue(submissions.contains(sub1));
    assertTrue(submissions.contains(sub2));
    assertTrue(submissions.indexOf(sub2) < submissions.indexOf(sub1));
    submissions=searcher.submissionSearch(filter,SearchOrder.PRIMARY_DOCUMENT,SearchDirection.DESCENDING,0,20).getResults();
    assertTrue(submissions.contains(sub1));
    assertTrue(submissions.contains(sub2));
    assertTrue(submissions.indexOf(sub2) < submissions.indexOf(sub1));
    submissions=searcher.submissionSearch(filter,SearchOrder.COMMITTEE_MEMBERS,SearchDirection.DESCENDING,0,20).getResults();
    assertTrue(submissions.contains(sub1));
    assertTrue(submissions.contains(sub2));
    assertTrue(submissions.indexOf(sub1) < submissions.indexOf(sub2));
    submissions=searcher.submissionSearch(filter,SearchOrder.COMMITTEE_CONTACT_EMAIL,SearchDirection.DESCENDING,0,20).getResults();
    assertTrue(submissions.contains(sub1));
    assertTrue(submissions.contains(sub2));
    assertTrue(submissions.indexOf(sub1) < submissions.indexOf(sub2));
    submissions=searcher.submissionSearch(filter,SearchOrder.COMMITTEE_APPROVAL_DATE,SearchDirection.DESCENDING,0,20).getResults();
    assertTrue(submissions.contains(sub1));
    assertTrue(submissions.contains(sub2));
    assertTrue(submissions.indexOf(sub1) < submissions.indexOf(sub2));
    submissions=searcher.submissionSearch(filter,SearchOrder.COMMITTEE_APPROVAL_DATE,SearchDirection.DESCENDING,0,20).getResults();
    assertTrue(submissions.contains(sub1));
    assertTrue(submissions.contains(sub2));
    assertTrue(submissions.indexOf(sub1) < submissions.indexOf(sub2));
    submissions=searcher.submissionSearch(filter,SearchOrder.SUBMISSION_DATE,SearchDirection.DESCENDING,0,20).getResults();
    assertTrue(submissions.contains(sub1));
    assertTrue(submissions.contains(sub2));
    assertTrue(submissions.indexOf(sub1) < submissions.indexOf(sub2));
    submissions=searcher.submissionSearch(filter,SearchOrder.APPROVAL_DATE,SearchDirection.DESCENDING,0,20).getResults();
    assertTrue(submissions.contains(sub1));
    assertTrue(submissions.contains(sub2));
    assertTrue(submissions.indexOf(sub1) < submissions.indexOf(sub2));
    submissions=searcher.submissionSearch(filter,SearchOrder.LICENSE_AGREEMENT_DATE,SearchDirection.DESCENDING,0,20).getResults();
    assertTrue(submissions.contains(sub1));
    assertTrue(submissions.contains(sub2));
    assertTrue(submissions.indexOf(sub1) < submissions.indexOf(sub2));
    submissions=searcher.submissionSearch(filter,SearchOrder.DEGREE,SearchDirection.DESCENDING,0,20).getResults();
    assertTrue(submissions.contains(sub1));
    assertTrue(submissions.contains(sub2));
    assertTrue(submissions.indexOf(sub1) < submissions.indexOf(sub2));
    submissions=searcher.submissionSearch(filter,SearchOrder.DEPARTMENT,SearchDirection.DESCENDING,0,20).getResults();
    assertTrue(submissions.contains(sub1));
    assertTrue(submissions.contains(sub2));
    assertTrue(submissions.indexOf(sub1) < submissions.indexOf(sub2));
    submissions=searcher.submissionSearch(filter,SearchOrder.COLLEGE,SearchDirection.DESCENDING,0,20).getResults();
    assertTrue(submissions.contains(sub1));
    assertTrue(submissions.contains(sub2));
    assertTrue(submissions.indexOf(sub1) < submissions.indexOf(sub2));
    submissions=searcher.submissionSearch(filter,SearchOrder.COLLEGE,SearchDirection.DESCENDING,0,20).getResults();
    assertTrue(submissions.contains(sub1));
    assertTrue(submissions.contains(sub2));
    assertTrue(submissions.indexOf(sub1) < submissions.indexOf(sub2));
    submissions=searcher.submissionSearch(filter,SearchOrder.MAJOR,SearchDirection.DESCENDING,0,20).getResults();
    assertTrue(submissions.contains(sub1));
    assertTrue(submissions.contains(sub2));
    assertTrue(submissions.indexOf(sub1) < submissions.indexOf(sub2));
    submissions=searcher.submissionSearch(filter,SearchOrder.DOCUMENT_TYPE,SearchDirection.DESCENDING,0,20).getResults();
    assertTrue(submissions.contains(sub1));
    assertTrue(submissions.contains(sub2));
    assertTrue(submissions.indexOf(sub1) < submissions.indexOf(sub2));
    submissions=searcher.submissionSearch(filter,SearchOrder.GRADUATION_DATE,SearchDirection.DESCENDING,0,20).getResults();
    assertTrue(submissions.contains(sub1));
    assertTrue(submissions.contains(sub2));
    assertTrue(submissions.indexOf(sub1) < submissions.indexOf(sub2));
    submissions=searcher.submissionSearch(filter,SearchOrder.DEFENSE_DATE,SearchDirection.DESCENDING,0,20).getResults();
    assertTrue(submissions.contains(sub1));
    assertTrue(submissions.contains(sub2));
    assertTrue(submissions.indexOf(sub1) < submissions.indexOf(sub2));
    submissions=searcher.submissionSearch(filter,SearchOrder.STATE,SearchDirection.DESCENDING,0,20).getResults();
    assertTrue(submissions.contains(sub1));
    assertTrue(submissions.contains(sub2));
    assertTrue(submissions.indexOf(sub2) < submissions.indexOf(sub1));
    submissions=searcher.submissionSearch(filter,SearchOrder.GRADUATION_DATE,SearchDirection.DESCENDING,0,20).getResults();
    assertTrue(submissions.contains(sub1));
    assertTrue(submissions.contains(sub2));
    assertTrue(submissions.indexOf(sub1) < submissions.indexOf(sub2));
    submissions=searcher.submissionSearch(filter,SearchOrder.UMI_RELEASE,SearchDirection.DESCENDING,0,20).getResults();
    assertTrue(submissions.contains(sub1));
    assertTrue(submissions.contains(sub2));
    assertTrue(submissions.indexOf(sub1) < submissions.indexOf(sub2));
    submissions=searcher.submissionSearch(filter,SearchOrder.DEPOSIT_ID,SearchDirection.DESCENDING,0,20).getResults();
    assertTrue(submissions.contains(sub1));
    assertTrue(submissions.contains(sub2));
    assertTrue(submissions.indexOf(sub1) < submissions.indexOf(sub2));
    submissions=searcher.submissionSearch(filter,SearchOrder.REVIEWER_NOTES,SearchDirection.DESCENDING,0,20).getResults();
    assertTrue(submissions.contains(sub1));
    assertTrue(submissions.contains(sub2));
    assertTrue(submissions.indexOf(sub1) < submissions.indexOf(sub2));
    submissions=searcher.submissionSearch(filter,SearchOrder.LAST_EVENT_ENTRY,SearchDirection.DESCENDING,0,20).getResults();
    assertTrue(submissions.contains(sub1));
    assertTrue(submissions.contains(sub2));
    assertTrue(submissions.indexOf(sub1) < submissions.indexOf(sub2));
    submissions=searcher.submissionSearch(filter,SearchOrder.LAST_EVENT_TIME,SearchDirection.DESCENDING,0,20).getResults();
    assertTrue(submissions.contains(sub1));
    assertTrue(submissions.contains(sub2));
    assertTrue(submissions.indexOf(sub2) < submissions.indexOf(sub1));
    submissions=searcher.submissionSearch(filter,SearchOrder.ORCID,SearchDirection.DESCENDING,0,20).getResults();
    assertTrue(submissions.contains(sub1));
    assertTrue(submissions.contains(sub2));
    assertTrue(submissions.indexOf(sub1) < submissions.indexOf(sub2));
  }
  finally {
    filter.delete();
    subRepo.findSubmission(sub1.getId()).delete();
    subRepo.findSubmission(sub2.getId()).delete();
    file1.delete();
    file2.delete();
    settingRepo.findEmbargoType(e1.getId()).delete();
    settingRepo.findEmbargoType(e2.getId()).delete();
    settingRepo.findCustomActionDefinition(def.getId()).delete();
    personRepo.findPerson(otherPerson.getId()).delete();
  }
}