use of se.inera.intyg.webcert.common.model.GroupableItem in project webcert by sklintyg.
the class StatisticsGroupByUtilTest method testFilterInvalidGroupableItems.
@Test
public void testFilterInvalidGroupableItems() {
List<GroupableItem> queryResult = new ArrayList<>();
queryResult.add(new GroupableItem("id-1", HSA1, PNR1, FK7263));
queryResult.add(new GroupableItem("id-2", HSA2, PNR2, TSBAS));
queryResult.add(new GroupableItem("id-3", HSA1, null, FK7263));
queryResult.add(new GroupableItem("id-4", HSA1, "", TSBAS));
queryResult.add(new GroupableItem("id-5", HSA2, "thisisainvalidparameter", FK7263));
List<GroupableItem> result = testee.getFilteredGroupableItemList(queryResult);
assertEquals(2, result.size());
}
use of se.inera.intyg.webcert.common.model.GroupableItem in project webcert by sklintyg.
the class StatisticsGroupByUtilTest method testFilterAndGroupForMultipleUnitsForLakare.
@Test
public void testFilterAndGroupForMultipleUnitsForLakare() {
when(webCertUserService.getUser()).thenReturn(createUser());
List<GroupableItem> queryResult = new ArrayList<>();
queryResult.add(new GroupableItem("id-1", HSA1, PNR1, FK7263));
queryResult.add(new GroupableItem("id-2", HSA1, PNR2, FK7263));
queryResult.add(new GroupableItem("id-3", HSA1, PNR3, FK7263));
queryResult.add(new GroupableItem("id-4", HSA2, PNR3, FK7263));
queryResult.add(new GroupableItem("id-5", HSA2, PNR1, FK7263));
queryResult.add(new GroupableItem("id-6", HSA2, PNR3, FK7263));
queryResult.add(new GroupableItem("id-7", HSA2, PNR1, TSBAS));
// Never this one.
queryResult.add(new GroupableItem("id-8", HSA1, PNR2, TSBAS));
Map<String, Long> result = testee.toSekretessFilteredMap(queryResult);
assertEquals(2, result.size());
assertEquals(new Long(3L), result.get(HSA1));
assertEquals(new Long(4L), result.get(HSA2));
}
use of se.inera.intyg.webcert.common.model.GroupableItem in project webcert by sklintyg.
the class StatisticsGroupByUtilTest method testFilterInvalidPersonnummer.
@Test
public void testFilterInvalidPersonnummer() {
List<GroupableItem> queryResult = new ArrayList<>();
queryResult.add(new GroupableItem("id-1", HSA1, PNR1, FK7263));
queryResult.add(new GroupableItem("id-2", HSA2, PNR2, TSBAS));
queryResult.add(new GroupableItem("id-3", HSA1, null, FK7263));
queryResult.add(new GroupableItem("id-4", HSA1, "", TSBAS));
queryResult.add(new GroupableItem("id-5", HSA2, "thisisainvalidparameter", FK7263));
List<Personnummer> result = testee.getPersonummerList(queryResult);
assertEquals(2, result.size());
}
use of se.inera.intyg.webcert.common.model.GroupableItem in project webcert by sklintyg.
the class StatisticsGroupByUtilTest method testFilterAndGroupForTwoResultsOfSameUnitOneIsSekrForVardadmin.
@Test
public void testFilterAndGroupForTwoResultsOfSameUnitOneIsSekrForVardadmin() {
when(webCertUserService.getUser()).thenReturn(buildUserOfRole(AUTHORITIES_RESOLVER.getRole("VARDADMINISTRATOR")));
Personnummer pnr1 = Personnummer.createPersonnummer(PNR1).get();
Personnummer pnr2 = Personnummer.createPersonnummer(PNR2).get();
Map<Personnummer, SekretessStatus> sekrMap = new HashMap<>();
sekrMap.put(pnr1, SekretessStatus.FALSE);
sekrMap.put(pnr2, SekretessStatus.TRUE);
when(patientDetailsResolver.getSekretessStatusForList(anyList())).thenReturn(sekrMap);
List<GroupableItem> queryResult = new ArrayList<>();
queryResult.add(new GroupableItem("id-1", HSA1, PNR1, FK7263));
queryResult.add(new GroupableItem("id-2", HSA1, PNR2, FK7263));
// Should be filtered away
queryResult.add(new GroupableItem("id-3", HSA1, PNR2, TSBAS));
Map<String, Long> result = testee.toSekretessFilteredMap(queryResult);
assertEquals(1, result.size());
assertEquals(new Long(1L), result.get(HSA1));
}
use of se.inera.intyg.webcert.common.model.GroupableItem in project webcert by sklintyg.
the class StatisticsGroupByUtilTest method testFilterAndGroupForTwoResultsOfSameUnitOneIsSekrForLakare.
@Test
public void testFilterAndGroupForTwoResultsOfSameUnitOneIsSekrForLakare() {
when(webCertUserService.getUser()).thenReturn(createUser());
List<GroupableItem> queryResult = new ArrayList<>();
queryResult.add(new GroupableItem("id-1", HSA1, PNR1, FK7263));
queryResult.add(new GroupableItem("id-2", HSA1, PNR2, FK7263));
Map<String, Long> result = testee.toSekretessFilteredMap(queryResult);
assertEquals(1, result.size());
assertEquals(new Long(2L), result.get(HSA1));
}
Aggregations