use of se.inera.intyg.common.support.modules.registry.IntygModule in project webcert by sklintyg.
the class ModuleApiControllerTest method testModuleDetailedDescriptionReplaced.
@SuppressWarnings("unchecked")
@Test
public void testModuleDetailedDescriptionReplaced() {
Response response = moduleApiController.getModulesMap();
assertNotNull(response);
List<IntygModule> res = (List<IntygModule>) response.getEntity();
assertEquals(3, res.size());
assertEquals(SOME_REPLACED_DESCRIPTION, res.get(0).getDetailedDescription());
}
use of se.inera.intyg.common.support.modules.registry.IntygModule in project webcert by sklintyg.
the class ModuleApiControllerTest method testGetActiveModulesNoActive.
@SuppressWarnings("unchecked")
@Test
public void testGetActiveModulesNoActive() {
when(authoritiesHelper.isFeatureActive(AuthoritiesConstants.FEATURE_HANTERA_INTYGSUTKAST, MODULE_ID_1)).thenReturn(false);
when(authoritiesHelper.isFeatureActive(AuthoritiesConstants.FEATURE_HANTERA_INTYGSUTKAST, MODULE_ID_2)).thenReturn(false);
when(authoritiesHelper.isFeatureActive(AuthoritiesConstants.FEATURE_HANTERA_INTYGSUTKAST, MODULE_ID_3)).thenReturn(false);
Response response = moduleApiController.getActiveModules();
assertNotNull(response);
List<IntygModule> res = (List<IntygModule>) response.getEntity();
assertTrue(res.isEmpty());
}
use of se.inera.intyg.common.support.modules.registry.IntygModule in project webcert by sklintyg.
the class UtkastApiControllerTest method setup.
@Before
public void setup() throws ModuleNotFoundException {
when(patientDetailsResolver.getSekretessStatus(eq(PATIENT_PERSONNUMMER))).thenReturn(SekretessStatus.FALSE);
when(patientDetailsResolver.resolvePatient(any(Personnummer.class), anyString())).thenReturn(buildPatient());
when(moduleRegistry.getIntygModule(eq(LuseEntryPoint.MODULE_ID))).thenReturn(new IntygModule("luse", "", "", "", "", "", "", "", "", false));
when(moduleRegistry.getIntygModule(eq(Fk7263EntryPoint.MODULE_ID))).thenReturn(new IntygModule("fk7263", "", "", "", "", "", "", "", "", true));
Map<String, Map<String, Boolean>> hasPrevious = new HashMap<>();
Map<String, Boolean> hasPreviousIntyg = new HashMap<>();
hasPreviousIntyg.put("luse", true);
hasPrevious.put("intyg", hasPreviousIntyg);
when(utkastService.checkIfPersonHasExistingIntyg(eq(PATIENT_PERSONNUMMER), any())).thenReturn(hasPrevious);
}
use of se.inera.intyg.common.support.modules.registry.IntygModule in project webcert by sklintyg.
the class ModuleApiControllerTest method testGetActiveModules.
@SuppressWarnings("unchecked")
@Test
public void testGetActiveModules() {
when(authoritiesHelper.isFeatureActive(AuthoritiesConstants.FEATURE_HANTERA_INTYGSUTKAST, MODULE_ID_1)).thenReturn(true);
when(authoritiesHelper.isFeatureActive(AuthoritiesConstants.FEATURE_HANTERA_INTYGSUTKAST, MODULE_ID_2)).thenReturn(true);
when(authoritiesHelper.isFeatureActive(AuthoritiesConstants.FEATURE_HANTERA_INTYGSUTKAST, MODULE_ID_3)).thenReturn(true);
Response response = moduleApiController.getActiveModules();
assertNotNull(response);
List<IntygModule> res = (List<IntygModule>) response.getEntity();
assertEquals(3, res.size());
assertEquals(MODULE_ID_1, res.get(0).getId());
assertEquals(MODULE_ID_2, res.get(1).getId());
assertEquals(MODULE_ID_3, res.get(2).getId());
}
use of se.inera.intyg.common.support.modules.registry.IntygModule in project webcert by sklintyg.
the class IntygServiceTest method testListCertificatesForCareWithQANoNotifications.
@Test
public void testListCertificatesForCareWithQANoNotifications() throws Exception {
final List<String> enhetList = Arrays.asList("enhet");
final String intygType = "intygType";
final String intygId = "intygId";
Fk7263Utlatande utlatande = objectMapper.readValue(json, Fk7263Utlatande.class);
ArendeCount sent = new ArendeCount(1, 2, 3, 4);
ArendeCount received = new ArendeCount(5, 6, 7, 8);
when(moduleRegistry.listAllModules()).thenReturn(Arrays.asList(new IntygModule(intygType, "", "", "", "", "", "", "", "", false)));
when(utkastRepository.findDraftsByPatientAndEnhetAndStatus(eq(PERSON_ID), eq(enhetList), eq(Arrays.asList(UtkastStatus.values())), eq(Collections.singleton(intygType)))).thenReturn(Arrays.asList(getDraft(intygId)));
when(notificationService.getNotifications(eq(intygId))).thenReturn(Collections.emptyList());
when(moduleRegistry.getModuleApi(any(String.class))).thenReturn(moduleApi);
when(moduleApi.getUtlatandeFromJson(anyString())).thenReturn(utlatande);
when(fragorOchSvarCreator.createArenden(eq(intygId), anyString())).thenReturn(Pair.of(sent, received));
List<IntygWithNotificationsResponse> res = intygService.listCertificatesForCareWithQA(new IntygWithNotificationsRequest.Builder().setPersonnummer(PERSNR).setEnhetId(enhetList).build());
assertNotNull(res);
assertEquals(1, res.size());
assertTrue(res.get(0).getNotifications().isEmpty());
assertEquals(1, res.get(0).getSentQuestions().getTotalt());
assertEquals(2, res.get(0).getSentQuestions().getEjBesvarade());
assertEquals(3, res.get(0).getSentQuestions().getBesvarade());
assertEquals(4, res.get(0).getSentQuestions().getHanterade());
assertEquals(5, res.get(0).getReceivedQuestions().getTotalt());
assertEquals(6, res.get(0).getReceivedQuestions().getEjBesvarade());
assertEquals(7, res.get(0).getReceivedQuestions().getBesvarade());
assertEquals(8, res.get(0).getReceivedQuestions().getHanterade());
}
Aggregations