use of org.pmiops.workbench.cohortreview.util.PageRequest in project workbench by all-of-us.
the class CohortReviewServiceImplTest method findParticipantCohortStatuses.
@Test
public void findParticipantCohortStatuses() throws Exception {
long cohortReviewId = 1;
PageRequest pageRequest = new PageRequest(0, 1, ParticipantCohortStatusColumns.PARTICIPANTID.toString());
when(participantCohortStatusDao.findAll(cohortReviewId, Collections.<Filter>emptyList(), pageRequest)).thenReturn(new ArrayList<>());
cohortReviewService.findAll(cohortReviewId, Collections.<Filter>emptyList(), pageRequest);
verify(participantCohortStatusDao).findAll(cohortReviewId, Collections.<Filter>emptyList(), pageRequest);
verifyNoMoreMockInteractions();
}
use of org.pmiops.workbench.cohortreview.util.PageRequest in project workbench by all-of-us.
the class ParticipantCohortStatusDaoTest method findAllBadFilterValuesSize.
@Test
public void findAllBadFilterValuesSize() throws Exception {
PageRequest pageRequest = new PageRequest(page, pageSize, SortOrder.ASC, ParticipantCohortStatusColumns.PARTICIPANTID.toString());
List<Filter> filters = new ArrayList<>();
filters.add(new Filter().property(ParticipantCohortStatusColumns.PARTICIPANTID).operator(Operator.EQUAL).values(Arrays.asList("1", "2")));
assertBadRequest(pageRequest, filters, "Invalid request: property: participantId using operartor: EQUAL must have a single value.");
filters.clear();
filters.add(new Filter().property(ParticipantCohortStatusColumns.STATUS).operator(Operator.EQUAL).values(new ArrayList<>()));
assertBadRequest(pageRequest, filters, "Invalid request: property: status values: is empty.");
}
use of org.pmiops.workbench.cohortreview.util.PageRequest in project workbench by all-of-us.
the class ParticipantCohortStatusDaoTest method findAllPaging.
@Test
public void findAllPaging() throws Exception {
PageRequest pageRequest = new PageRequest(page, 1, SortOrder.ASC, ParticipantCohortStatusColumns.PARTICIPANTID.toString());
List<ParticipantCohortStatus> results = participantCohortStatusDao.findAll(1L, Collections.<Filter>emptyList(), pageRequest);
assertEquals(1, results.size());
ParticipantCohortStatus expectedPCS = createExpectedPCSWithConceptValues(new ParticipantCohortStatusKey().cohortReviewId(COHORT_REVIEW_ID).participantId(1), CohortStatus.INCLUDED);
expectedPCS.setBirthDate(results.get(0).getBirthDate());
assertEquals(expectedPCS, results.get(0));
pageRequest = new PageRequest(1, 1, SortOrder.ASC, ParticipantCohortStatusColumns.PARTICIPANTID.toString());
results = participantCohortStatusDao.findAll(1L, Collections.<Filter>emptyList(), pageRequest);
assertEquals(1, results.size());
expectedPCS = createExpectedPCSWithConceptValues(new ParticipantCohortStatusKey().cohortReviewId(COHORT_REVIEW_ID).participantId(2), CohortStatus.EXCLUDED);
expectedPCS.setBirthDate(results.get(0).getBirthDate());
assertEquals(expectedPCS, results.get(0));
}
use of org.pmiops.workbench.cohortreview.util.PageRequest in project workbench by all-of-us.
the class ParticipantCohortStatusDaoTest method findAllNoSearchCriteria.
@Test
public void findAllNoSearchCriteria() throws Exception {
PageRequest pageRequest = new PageRequest(page, pageSize, SortOrder.ASC, ParticipantCohortStatusColumns.PARTICIPANTID.toString());
List<ParticipantCohortStatus> results = participantCohortStatusDao.findAll(1L, Collections.<Filter>emptyList(), pageRequest);
assertEquals(2, results.size());
ParticipantCohortStatus participant1 = createExpectedPCSWithConceptValues(new ParticipantCohortStatusKey().cohortReviewId(COHORT_REVIEW_ID).participantId(1), CohortStatus.INCLUDED);
participant1.setBirthDate(results.get(0).getBirthDate());
ParticipantCohortStatus participant2 = createExpectedPCSWithConceptValues(new ParticipantCohortStatusKey().cohortReviewId(COHORT_REVIEW_ID).participantId(1), CohortStatus.EXCLUDED);
participant2.setBirthDate(results.get(1).getBirthDate());
assertEquals(participant1, results.get(0));
assertEquals(participant2, results.get(1));
}
use of org.pmiops.workbench.cohortreview.util.PageRequest in project workbench by all-of-us.
the class ParticipantCohortStatusDaoTest method findAllSearchCriteriaEqual.
@Test
public void findAllSearchCriteriaEqual() throws Exception {
PageRequest pageRequest = new PageRequest(page, pageSize, SortOrder.ASC, ParticipantCohortStatusColumns.PARTICIPANTID.toString());
List<Filter> filters = new ArrayList<>();
filters.add(new Filter().property(ParticipantCohortStatusColumns.PARTICIPANTID).operator(Operator.EQUAL).values(Arrays.asList("1")));
filters.add(new Filter().property(ParticipantCohortStatusColumns.STATUS).operator(Operator.EQUAL).values(Arrays.asList(CohortStatus.INCLUDED.toString())));
filters.add(new Filter().property(ParticipantCohortStatusColumns.BIRTHDATE).operator(Operator.EQUAL).values(Arrays.asList(new Date(System.currentTimeMillis()).toString())));
filters.add(new Filter().property(ParticipantCohortStatusColumns.GENDER).operator(Operator.EQUAL).values(Arrays.asList("MALE")));
filters.add(new Filter().property(ParticipantCohortStatusColumns.RACE).operator(Operator.EQUAL).values(Arrays.asList("Asian")));
filters.add(new Filter().property(ParticipantCohortStatusColumns.ETHNICITY).operator(Operator.EQUAL).values(Arrays.asList("Not Hispanic")));
List<ParticipantCohortStatus> results = participantCohortStatusDao.findAll(1L, filters, pageRequest);
assertEquals(1, results.size());
ParticipantCohortStatus expectedPCS = createExpectedPCSWithConceptValues(new ParticipantCohortStatusKey().cohortReviewId(COHORT_REVIEW_ID).participantId(1), CohortStatus.INCLUDED);
expectedPCS.setBirthDate(results.get(0).getBirthDate());
assertEquals(expectedPCS, results.get(0));
}
Aggregations