use of org.pmiops.workbench.model.Criteria in project workbench by all-of-us.
the class CohortBuilderControllerMockTest method getCriteriaByTypeAndParentIdIcd10.
@Test
public void getCriteriaByTypeAndParentIdIcd10() throws Exception {
org.pmiops.workbench.cdr.model.Criteria expectedCriteria = new org.pmiops.workbench.cdr.model.Criteria().id(1L).type("ICD10").name("DIAGNOSIS CODES").group(true).selectable(true).count("0").conceptId("0");
when(mockCdrVersionDao.findOne(1L)).thenReturn(new CdrVersion());
when(mockCriteriaDao.findCriteriaByTypeAndParentIdOrderByCodeAsc("ICD10", 0L)).thenReturn(Arrays.asList(expectedCriteria));
assertCriteria(controller.getCriteriaByTypeAndParentId(1L, "ICD10", 0L), new Criteria().id(1L).type("ICD10").name("DIAGNOSIS CODES").group(true).selectable(true).count(0L).conceptId(0L));
verify(mockCdrVersionDao).findOne(1L);
verify(mockCriteriaDao).findCriteriaByTypeAndParentIdOrderByCodeAsc("ICD10", 0L);
verifyNoMoreInteractions(mockCriteriaDao, mockCdrVersionDao);
}
use of org.pmiops.workbench.model.Criteria in project workbench by all-of-us.
the class CohortBuilderControllerMockTest method getCriteriaByTypeAndSubtypeDemographics.
@Test
public void getCriteriaByTypeAndSubtypeDemographics() throws Exception {
org.pmiops.workbench.cdr.model.Criteria expectedCriteria = new org.pmiops.workbench.cdr.model.Criteria().id(1L).type("DEMO").subtype("RACE").name("African American").group(false).selectable(true).count("100").conceptId("0");
when(mockCdrVersionDao.findOne(1L)).thenReturn(new CdrVersion());
when(mockCriteriaDao.findCriteriaByTypeAndSubtypeOrderByNameAsc("DEMO", "RACE")).thenReturn(Arrays.asList(expectedCriteria));
assertCriteria(controller.getCriteriaByTypeAndSubtype(1l, "DEMO", "RACE"), new Criteria().id(1L).type("DEMO").subtype("RACE").name("African American").group(false).selectable(true).count(100L).conceptId(0L));
verify(mockCdrVersionDao).findOne(1L);
verify(mockCriteriaDao).findCriteriaByTypeAndSubtypeOrderByNameAsc("DEMO", "RACE");
verifyNoMoreInteractions(mockCriteriaDao, mockCdrVersionDao);
}
use of org.pmiops.workbench.model.Criteria in project workbench by all-of-us.
the class CohortBuilderControllerMockTest method getCriteriaByTypeAndParentIdPhecodes.
@Test
public void getCriteriaByTypeAndParentIdPhecodes() throws Exception {
org.pmiops.workbench.cdr.model.Criteria expectedCriteria = new org.pmiops.workbench.cdr.model.Criteria().id(1L).type("PHECODE").name("Intestinal infection").group(true).selectable(true).count("0").conceptId("0");
when(mockCdrVersionDao.findOne(1L)).thenReturn(new CdrVersion());
when(mockCriteriaDao.findCriteriaByTypeAndParentIdOrderByCodeAsc("PHECODE", 0L)).thenReturn(Arrays.asList(expectedCriteria));
assertCriteria(controller.getCriteriaByTypeAndParentId(1l, "PHECODE", 0L), new Criteria().id(1L).type("PHECODE").name("Intestinal infection").group(true).selectable(true).count(0L).conceptId(0L));
verify(mockCdrVersionDao).findOne(1L);
verify(mockCriteriaDao).findCriteriaByTypeAndParentIdOrderByCodeAsc("PHECODE", 0L);
verifyNoMoreInteractions(mockCriteriaDao, mockCdrVersionDao);
}
use of org.pmiops.workbench.model.Criteria in project workbench by all-of-us.
the class CohortBuilderControllerMockTest method getCriteriaByTypeAndParentIdDemo.
@Test
public void getCriteriaByTypeAndParentIdDemo() throws Exception {
org.pmiops.workbench.cdr.model.Criteria expectedCriteria = new org.pmiops.workbench.cdr.model.Criteria().id(1L).type("DEMO").name("Age").group(false).selectable(true).count("0").conceptId("12").subtype("AGE");
when(mockCdrVersionDao.findOne(1L)).thenReturn(new CdrVersion());
when(mockCriteriaDao.findCriteriaByTypeAndParentIdOrderByCodeAsc("DEMO", 0L)).thenReturn(Arrays.asList(expectedCriteria));
assertCriteria(controller.getCriteriaByTypeAndParentId(1L, "DEMO", 0L), new Criteria().id(1L).type("DEMO").name("Age").group(false).selectable(true).count(0L).conceptId(12L).subtype("AGE"));
verify(mockCdrVersionDao).findOne(1L);
verify(mockCriteriaDao).findCriteriaByTypeAndParentIdOrderByCodeAsc("DEMO", 0L);
verifyNoMoreInteractions(mockCriteriaDao, mockCdrVersionDao);
}
use of org.pmiops.workbench.model.Criteria in project workbench by all-of-us.
the class CohortBuilderControllerMockTest method getCriteriaTreeQuickSearch.
@Test
public void getCriteriaTreeQuickSearch() throws Exception {
org.pmiops.workbench.cdr.model.Criteria expectedCriteria = new org.pmiops.workbench.cdr.model.Criteria().id(1L).type("PHECODE").name("Intestinal infection").group(true).selectable(true).count("0").conceptId("0");
when(mockCdrVersionDao.findOne(1L)).thenReturn(new CdrVersion());
when(mockCriteriaDao.findCriteriaByTypeAndNameOrCode("PHECODE", "infect*")).thenReturn(Arrays.asList(expectedCriteria));
assertCriteria(controller.getCriteriaTreeQuickSearch(1L, "PHECODE", "infect"), new Criteria().id(1L).type("PHECODE").name("Intestinal infection").group(true).selectable(true).count(0L).conceptId(0L));
verify(mockCdrVersionDao).findOne(1L);
verify(mockCriteriaDao).findCriteriaByTypeAndNameOrCode("PHECODE", "infect*");
verifyNoMoreInteractions(mockCriteriaDao, mockCdrVersionDao);
}
Aggregations