Search in sources :

Example 11 with CertificateResponse

use of se.inera.intyg.common.support.modules.support.api.dto.CertificateResponse in project webcert by sklintyg.

the class UtkastIntygDecoratorTest method testRevokedStatusOnIntygDoesNotAddAnyStatuses.

@Test
public void testRevokedStatusOnIntygDoesNotAddAnyStatuses() {
    CertificateResponse response = buildCertificateResponse();
    response.getMetaData().getStatus().add(new Status(CertificateState.CANCELLED, "FKASSA", LocalDateTime.now()));
    testee.decorateWithUtkastStatus(response);
    assertEquals(2, response.getMetaData().getStatus().size());
}
Also used : Status(se.inera.intyg.common.support.model.Status) UtkastStatus(se.inera.intyg.webcert.common.model.UtkastStatus) CertificateResponse(se.inera.intyg.common.support.modules.support.api.dto.CertificateResponse) Test(org.junit.Test)

Example 12 with CertificateResponse

use of se.inera.intyg.common.support.modules.support.api.dto.CertificateResponse in project webcert by sklintyg.

the class AbstractIntygServiceTest method setupMocks.

@Before
public void setupMocks() throws Exception {
    json = FileUtils.getStringFromFile(new ClassPathResource("IntygServiceTest/utlatande.json").getFile());
    utlatande = objectMapper.readValue(json, Fk7263Utlatande.class);
    CertificateMetaData metaData = buildCertificateMetaData();
    certificateResponse = new CertificateResponse(json, utlatande, metaData, false);
    when(moduleFacade.getCertificate(any(String.class), any(String.class))).thenReturn(certificateResponse);
    when(certificateRelationService.getNewestRelationOfType(anyString(), any(RelationKod.class), any(List.class))).thenReturn(Optional.empty());
    when(intygRelationHelper.getRelationsForIntyg(anyString())).thenReturn(new Relations());
    when(patientDetailsResolver.resolvePatient(any(Personnummer.class), anyString())).thenReturn(buildPatient(false, false));
    when(moduleRegistry.getModuleApi(anyString())).thenReturn(moduleApi);
    when(moduleApi.getUtlatandeFromJson(anyString())).thenReturn(new Fk7263Utlatande());
    when(moduleApi.updateBeforeSave(anyString(), any(Patient.class))).thenReturn("MODEL");
}
Also used : Personnummer(se.inera.intyg.schemas.contract.Personnummer) Fk7263Utlatande(se.inera.intyg.common.fk7263.model.internal.Fk7263Utlatande) CertificateResponse(se.inera.intyg.common.support.modules.support.api.dto.CertificateResponse) Patient(se.inera.intyg.common.support.model.common.internal.Patient) ArrayList(java.util.ArrayList) ArgumentMatchers.anyList(org.mockito.ArgumentMatchers.anyList) List(java.util.List) Relations(se.inera.intyg.webcert.web.web.controller.api.dto.Relations) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) ClassPathResource(org.springframework.core.io.ClassPathResource) CertificateMetaData(se.inera.intyg.common.support.modules.support.api.dto.CertificateMetaData) RelationKod(se.inera.intyg.common.support.common.enumerations.RelationKod) Before(org.junit.Before)

Example 13 with CertificateResponse

use of se.inera.intyg.common.support.modules.support.api.dto.CertificateResponse in project webcert by sklintyg.

the class IntygServiceRevokeTest method setupMocks.

@Override
@Before
public void setupMocks() throws Exception {
    json = FileUtils.getStringFromFile(new ClassPathResource("IntygServiceTest/utlatande.json").getFile());
    utlatande = objectMapper.readValue(json, Fk7263Utlatande.class);
    CertificateMetaData metaData = buildCertificateMetaData();
    certificateResponse = new CertificateResponse(json, utlatande, metaData, false);
    when(moduleFacade.getCertificate(any(String.class), any(String.class))).thenReturn(certificateResponse);
    when(intygRelationHelper.getRelationsForIntyg(anyString())).thenReturn(new Relations());
    when(patientDetailsResolver.resolvePatient(any(Personnummer.class), anyString())).thenReturn(buildPatient(false, false));
    when(moduleRegistry.getModuleApi(anyString())).thenReturn(moduleApi);
    when(moduleApi.getUtlatandeFromJson(anyString())).thenReturn(new Fk7263Utlatande());
    when(moduleApi.updateBeforeSave(anyString(), any(Patient.class))).thenReturn("MODEL");
}
Also used : Personnummer(se.inera.intyg.schemas.contract.Personnummer) Fk7263Utlatande(se.inera.intyg.common.fk7263.model.internal.Fk7263Utlatande) CertificateResponse(se.inera.intyg.common.support.modules.support.api.dto.CertificateResponse) Patient(se.inera.intyg.common.support.model.common.internal.Patient) Relations(se.inera.intyg.webcert.web.web.controller.api.dto.Relations) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) ClassPathResource(org.springframework.core.io.ClassPathResource) CertificateMetaData(se.inera.intyg.common.support.modules.support.api.dto.CertificateMetaData) Before(org.junit.Before)

Example 14 with CertificateResponse

use of se.inera.intyg.common.support.modules.support.api.dto.CertificateResponse in project webcert by sklintyg.

the class IntygServiceTest method setupIntygstjanstResponse.

@Before
public void setupIntygstjanstResponse() throws Exception {
    vardpersonReferens = new VardpersonReferens();
    vardpersonReferens.setHsaId(HSA_ID);
    vardpersonReferens.setNamn(CREATED_BY_NAME);
    json = FileUtils.getStringFromFile(new ClassPathResource("IntygServiceTest/utlatande.json").getFile());
    Fk7263Utlatande utlatande = objectMapper.readValue(json, Fk7263Utlatande.class);
    CertificateMetaData metaData = new CertificateMetaData();
    metaData.setStatus(new ArrayList<>());
    CertificateResponse certificateResponse = new CertificateResponse(json, utlatande, metaData, false);
    when(moduleFacade.getCertificate(any(String.class), any(String.class))).thenReturn(certificateResponse);
    when(moduleFacade.getUtlatandeFromInternalModel(anyString(), anyString())).thenReturn(utlatande);
}
Also used : Fk7263Utlatande(se.inera.intyg.common.fk7263.model.internal.Fk7263Utlatande) CertificateResponse(se.inera.intyg.common.support.modules.support.api.dto.CertificateResponse) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) ClassPathResource(org.springframework.core.io.ClassPathResource) CertificateMetaData(se.inera.intyg.common.support.modules.support.api.dto.CertificateMetaData) VardpersonReferens(se.inera.intyg.webcert.persistence.utkast.model.VardpersonReferens) Before(org.junit.Before)

Aggregations

CertificateResponse (se.inera.intyg.common.support.modules.support.api.dto.CertificateResponse)14 Test (org.junit.Test)9 CertificateMetaData (se.inera.intyg.common.support.modules.support.api.dto.CertificateMetaData)6 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)5 Fk7263Utlatande (se.inera.intyg.common.fk7263.model.internal.Fk7263Utlatande)5 Before (org.junit.Before)4 ClassPathResource (org.springframework.core.io.ClassPathResource)4 Status (se.inera.intyg.common.support.model.Status)3 Patient (se.inera.intyg.common.support.model.common.internal.Patient)3 Personnummer (se.inera.intyg.schemas.contract.Personnummer)3 UtkastStatus (se.inera.intyg.webcert.common.model.UtkastStatus)3 Relations (se.inera.intyg.webcert.web.web.controller.api.dto.Relations)3 Utlatande (se.inera.intyg.common.support.model.common.internal.Utlatande)2 IOException (java.io.IOException)1 LocalDateTime (java.time.LocalDateTime)1 ChronoLocalDateTime (java.time.chrono.ChronoLocalDateTime)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 WebServiceException (javax.xml.ws.WebServiceException)1 ArgumentMatchers.anyList (org.mockito.ArgumentMatchers.anyList)1