Search in sources :

Example 11 with Relation

use of se.inera.intyg.common.support.model.common.internal.Relation in project webcert by sklintyg.

the class IntygServiceSendTest method testSendIntygThrowsExceptionWhenPUServiceIsUnavailable.

@Test(expected = WebCertServiceException.class)
public void testSendIntygThrowsExceptionWhenPUServiceIsUnavailable() throws IOException {
    final String completionMeddelandeId = "meddelandeId";
    Utlatande completionUtlatande = utlatande;
    completionUtlatande.getGrundData().setRelation(new Relation());
    completionUtlatande.getGrundData().getRelation().setRelationKod(RelationKod.KOMPLT);
    completionUtlatande.getGrundData().getRelation().setMeddelandeId(completionMeddelandeId);
    when(moduleFacade.getUtlatandeFromInternalModel(isNull(), anyString())).thenReturn(completionUtlatande);
    when(webCertUserService.isAuthorizedForUnit(anyString(), anyString(), anyBoolean())).thenReturn(true);
    when(patientDetailsResolver.getSekretessStatus(any(Personnummer.class))).thenReturn(SekretessStatus.UNDEFINED);
    when(intygRepository.findOne(INTYG_ID)).thenReturn(getUtkast(INTYG_ID));
    try {
        intygService.sendIntyg(INTYG_ID, INTYG_TYP_FK, "FKASSA", false);
    } catch (Exception e) {
        verifyZeroInteractions(logService);
        throw e;
    }
}
Also used : Personnummer(se.inera.intyg.schemas.contract.Personnummer) Relation(se.inera.intyg.common.support.model.common.internal.Relation) WebcertCertificateRelation(se.inera.intyg.webcert.common.model.WebcertCertificateRelation) Fk7263Utlatande(se.inera.intyg.common.fk7263.model.internal.Fk7263Utlatande) Utlatande(se.inera.intyg.common.support.model.common.internal.Utlatande) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) WebCertServiceException(se.inera.intyg.webcert.common.service.exception.WebCertServiceException) IOException(java.io.IOException) Test(org.junit.Test)

Aggregations

Relation (se.inera.intyg.common.support.model.common.internal.Relation)11 Utlatande (se.inera.intyg.common.support.model.common.internal.Utlatande)8 Test (org.junit.Test)6 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)6 Fk7263Utlatande (se.inera.intyg.common.fk7263.model.internal.Fk7263Utlatande)6 WebcertCertificateRelation (se.inera.intyg.webcert.common.model.WebcertCertificateRelation)6 Personnummer (se.inera.intyg.schemas.contract.Personnummer)5 Utkast (se.inera.intyg.webcert.persistence.utkast.model.Utkast)5 WebCertUser (se.inera.intyg.webcert.web.service.user.dto.WebCertUser)5 IOException (java.io.IOException)4 LogRequest (se.inera.intyg.webcert.web.service.log.dto.LogRequest)4 IntygServiceResult (se.inera.intyg.webcert.web.service.intyg.dto.IntygServiceResult)3 ModuleApi (se.inera.intyg.common.support.modules.support.api.ModuleApi)2 ModuleException (se.inera.intyg.common.support.modules.support.api.exception.ModuleException)2 UtkastStatus (se.inera.intyg.webcert.common.model.UtkastStatus)2 WebCertServiceException (se.inera.intyg.webcert.common.service.exception.WebCertServiceException)2 CopyUtkastBuilderResponse (se.inera.intyg.webcert.web.service.utkast.dto.CopyUtkastBuilderResponse)2 Transactional (org.springframework.transaction.annotation.Transactional)1 GrundData (se.inera.intyg.common.support.model.common.internal.GrundData)1 Patient (se.inera.intyg.common.support.model.common.internal.Patient)1