Search in sources :

Example 6 with CertificateMetaData

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

the class UtkastIntygDecoratorTest method buildCertificateMetaData.

private CertificateMetaData buildCertificateMetaData() {
    CertificateMetaData metaData = new CertificateMetaData();
    metaData.setStatus(new ArrayList<Status>());
    Status statusSigned = new Status(CertificateState.RECEIVED, "FKASSA", LocalDateTime.now());
    metaData.getStatus().add(statusSigned);
    return metaData;
}
Also used : Status(se.inera.intyg.common.support.model.Status) UtkastStatus(se.inera.intyg.webcert.common.model.UtkastStatus) CertificateMetaData(se.inera.intyg.common.support.modules.support.api.dto.CertificateMetaData)

Example 7 with CertificateMetaData

use of se.inera.intyg.common.support.modules.support.api.dto.CertificateMetaData 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 8 with CertificateMetaData

use of se.inera.intyg.common.support.modules.support.api.dto.CertificateMetaData 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 9 with CertificateMetaData

use of se.inera.intyg.common.support.modules.support.api.dto.CertificateMetaData 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

CertificateMetaData (se.inera.intyg.common.support.modules.support.api.dto.CertificateMetaData)9 CertificateResponse (se.inera.intyg.common.support.modules.support.api.dto.CertificateResponse)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 Test (org.junit.Test)3 Status (se.inera.intyg.common.support.model.Status)2 Patient (se.inera.intyg.common.support.model.common.internal.Patient)2 Personnummer (se.inera.intyg.schemas.contract.Personnummer)2 Relations (se.inera.intyg.webcert.web.web.controller.api.dto.Relations)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 ArgumentMatchers.anyList (org.mockito.ArgumentMatchers.anyList)1 RelationKod (se.inera.intyg.common.support.common.enumerations.RelationKod)1 Relation (se.inera.intyg.common.support.model.common.internal.Relation)1 Utlatande (se.inera.intyg.common.support.model.common.internal.Utlatande)1 UtkastStatus (se.inera.intyg.webcert.common.model.UtkastStatus)1 WebcertCertificateRelation (se.inera.intyg.webcert.common.model.WebcertCertificateRelation)1 VardpersonReferens (se.inera.intyg.webcert.persistence.utkast.model.VardpersonReferens)1