Search in sources :

Example 1 with Criteria

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);
}
Also used : CdrVersion(org.pmiops.workbench.db.model.CdrVersion) Criteria(org.pmiops.workbench.model.Criteria) Test(org.junit.Test)

Example 2 with Criteria

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);
}
Also used : CdrVersion(org.pmiops.workbench.db.model.CdrVersion) Criteria(org.pmiops.workbench.model.Criteria) Test(org.junit.Test)

Example 3 with Criteria

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);
}
Also used : CdrVersion(org.pmiops.workbench.db.model.CdrVersion) Criteria(org.pmiops.workbench.model.Criteria) Test(org.junit.Test)

Example 4 with Criteria

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);
}
Also used : CdrVersion(org.pmiops.workbench.db.model.CdrVersion) Criteria(org.pmiops.workbench.model.Criteria) Test(org.junit.Test)

Example 5 with Criteria

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);
}
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