Search in sources :

Example 6 with Criteria

use of org.pmiops.workbench.model.Criteria in project workbench by all-of-us.

the class CohortBuilderControllerMockTest method getCriteriaByTypeAndParentIdIcd9.

@Test
public void getCriteriaByTypeAndParentIdIcd9() throws Exception {
    org.pmiops.workbench.cdr.model.Criteria expectedCriteria = new org.pmiops.workbench.cdr.model.Criteria().id(1L).type("ICD9").code("001-139.99").name("Infectious and parasitic diseases").group(false).selectable(false).count("0").conceptId("0");
    when(mockCdrVersionDao.findOne(1L)).thenReturn(new CdrVersion());
    when(mockCriteriaDao.findCriteriaByTypeAndParentIdOrderByCodeAsc("ICD9", 0L)).thenReturn(Arrays.asList(expectedCriteria));
    assertCriteria(controller.getCriteriaByTypeAndParentId(1L, "ICD9", 0L), new Criteria().id(1L).type("ICD9").code("001-139.99").name("Infectious and parasitic diseases").group(false).selectable(false).count(0L).conceptId(0L));
    verify(mockCdrVersionDao).findOne(1L);
    verify(mockCriteriaDao).findCriteriaByTypeAndParentIdOrderByCodeAsc("ICD9", 0L);
    verifyNoMoreInteractions(mockCriteriaDao, mockCdrVersionDao);
}
Also used : CdrVersion(org.pmiops.workbench.db.model.CdrVersion) Criteria(org.pmiops.workbench.model.Criteria) Test(org.junit.Test)

Example 7 with Criteria

use of org.pmiops.workbench.model.Criteria in project workbench by all-of-us.

the class CohortBuilderControllerMockTest method getCriteriaByTypeAndParentIdCPT.

@Test
public void getCriteriaByTypeAndParentIdCPT() throws Exception {
    org.pmiops.workbench.cdr.model.Criteria expectedCriteria = new org.pmiops.workbench.cdr.model.Criteria().id(1L).type("CPT").name("DIAGNOSIS CODES").group(true).selectable(true).count("0").conceptId("0");
    when(mockCdrVersionDao.findOne(1L)).thenReturn(new CdrVersion());
    when(mockCriteriaDao.findCriteriaByTypeAndParentIdOrderByCodeAsc("CPT", 0L)).thenReturn(Arrays.asList(expectedCriteria));
    assertCriteria(controller.getCriteriaByTypeAndParentId(1L, "CPT", 0L), new Criteria().id(1L).type("CPT").name("DIAGNOSIS CODES").group(true).selectable(true).count(0L).conceptId(0L));
    verify(mockCdrVersionDao).findOne(1L);
    verify(mockCriteriaDao).findCriteriaByTypeAndParentIdOrderByCodeAsc("CPT", 0L);
    verifyNoMoreInteractions(mockCriteriaDao, mockCdrVersionDao);
}
Also used : CdrVersion(org.pmiops.workbench.db.model.CdrVersion) Criteria(org.pmiops.workbench.model.Criteria) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)7 CdrVersion (org.pmiops.workbench.db.model.CdrVersion)7 Criteria (org.pmiops.workbench.model.Criteria)7