Search in sources :

Example 11 with IntygModule

use of se.inera.intyg.common.support.modules.registry.IntygModule in project webcert by sklintyg.

the class IntygServiceTest method testListCertificatesForCareWithQANoNotificationsTrim.

@Test
public void testListCertificatesForCareWithQANoNotificationsTrim() throws Exception {
    final LocalDateTime start = LocalDateTime.of(2017, Month.APRIL, 1, 1, 1);
    final LocalDateTime end = LocalDateTime.of(2018, Month.APRIL, 1, 1, 1);
    final String vardgivarId = "vardgivarId";
    final String intygType = "intygType";
    final String intygId = "intygId";
    when(moduleRegistry.listAllModules()).thenReturn(Collections.singletonList(new IntygModule(intygType, "", "", "", "", "", "", "", "", false)));
    when(utkastRepository.findDraftsByPatientAndVardgivareAndStatus(eq(PERSON_ID), eq(vardgivarId), eq(Arrays.asList(UtkastStatus.values())), eq(Collections.singleton(intygType)))).thenReturn(Collections.singletonList(getDraft(intygId)));
    when(notificationService.getNotifications(eq(intygId))).thenReturn(Collections.emptyList());
    List<IntygWithNotificationsResponse> res = intygService.listCertificatesForCareWithQA(new IntygWithNotificationsRequest.Builder().setPersonnummer(PERSNR).setVardgivarId(vardgivarId).setStartDate(start).setEndDate(end).build());
    assertNotNull(res);
    assertEquals(0, res.size());
}
Also used : LocalDateTime(java.time.LocalDateTime) IntygModule(se.inera.intyg.common.support.modules.registry.IntygModule) IntygWithNotificationsResponse(se.inera.intyg.webcert.web.service.intyg.dto.IntygWithNotificationsResponse) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) Test(org.junit.Test)

Aggregations

IntygModule (se.inera.intyg.common.support.modules.registry.IntygModule)11 Test (org.junit.Test)9 List (java.util.List)5 Response (javax.ws.rs.core.Response)5 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)5 IntygWithNotificationsResponse (se.inera.intyg.webcert.web.service.intyg.dto.IntygWithNotificationsResponse)4 LocalDateTime (java.time.LocalDateTime)3 Fk7263Utlatande (se.inera.intyg.common.fk7263.model.internal.Fk7263Utlatande)3 ArendeCount (se.inera.intyg.common.support.modules.support.api.notification.ArendeCount)3 Personnummer (se.inera.intyg.schemas.contract.Personnummer)2 Handelse (se.inera.intyg.webcert.persistence.handelse.model.Handelse)2 HashMap (java.util.HashMap)1 Map (java.util.Map)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1 Before (org.junit.Before)1 InvalidPersonNummerException (se.inera.intyg.schemas.contract.InvalidPersonNummerException)1 SekretessStatus (se.inera.intyg.webcert.common.model.SekretessStatus)1