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());
}
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");
}
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");
}
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);
}
Aggregations