use of se.inera.intyg.webcert.persistence.utkast.model.Utkast in project webcert by sklintyg.
the class PatientDetailsResolverTest method testSosDoiIntygIntegrationWithExistingDBIntygAndPuOk.
// - Dödsorsaksintyg - //
/**
* DOI - Integration. DB finns, PU finns. Namn och adress från DB-intyget, avliden/sekr från PU.
*/
@Test
public void testSosDoiIntygIntegrationWithExistingDBIntygAndPuOk() throws ModuleNotFoundException, IOException {
when(puService.getPerson(any(Personnummer.class))).thenReturn(buildPersonSvar());
when(webCertUserService.getUser()).thenReturn(integratedWebCertUser);
when(integratedWebCertUser.getValdVardgivare()).thenReturn(new Vardgivare("vg-1", "vardgivare-1"));
List<Utkast> drafts = buildSosDBDrafts();
when(utkastRepository.findDraftsByPatientAndVardgivareAndStatus(anyString(), anyString(), anyList(), anySet())).thenReturn(drafts);
ModuleApi moduleApi = mock(ModuleApi.class);
when(moduleApi.getUtlatandeFromJson(anyString())).thenReturn(buildSosDoiUtlatande());
when(moduleRegistry.getModuleApi("db")).thenReturn(moduleApi);
Patient patient = testee.resolvePatient(PNR, "doi");
assertEquals(PNR.getPersonnummer(), patient.getPersonId().getPersonnummer());
assertEquals(DB_FNAMN, patient.getFornamn());
assertEquals(DB_MNAMN, patient.getMellannamn());
assertEquals(DB_ENAMN, patient.getEfternamn());
assertEquals(DB_POST_ADDR, patient.getPostadress());
assertEquals(DB_POST_NR, patient.getPostnummer());
assertEquals(DB_POST_ORT, patient.getPostort());
assertEquals(PU_AVLIDEN || INTEGR_AVLIDEN, patient.isAvliden());
assertEquals(false, patient.isSekretessmarkering());
}
use of se.inera.intyg.webcert.persistence.utkast.model.Utkast in project webcert by sklintyg.
the class SignaturServiceImplTest method createUtkast.
private Utkast createUtkast(String intygId, long version, String type, UtkastStatus status, String model, VardpersonReferens vardperson, String enhetsId, String personId) {
Utkast utkast = new Utkast();
utkast.setIntygsId(intygId);
utkast.setVersion(version);
utkast.setIntygsTyp(type);
utkast.setStatus(status);
utkast.setModel(model);
utkast.setSkapadAv(vardperson);
utkast.setSenastSparadAv(vardperson);
utkast.setEnhetsId(enhetsId);
utkast.setPatientPersonnummer(Personnummer.createPersonnummer(personId).get());
return utkast;
}
use of se.inera.intyg.webcert.persistence.utkast.model.Utkast in project webcert by sklintyg.
the class SignaturServiceImplTest method serverSignatureFailureUniqueIntyg.
@Test
public void serverSignatureFailureUniqueIntyg() {
Feature f = new Feature();
f.setIntygstyper(ImmutableList.of(INTYG_TYPE));
f.setGlobal(true);
user.getFeatures().put(AuthoritiesConstants.FEATURE_UNIKT_INTYG, f);
when(mockUtkastRepository.findOne(INTYG_ID)).thenReturn(completedUtkast);
Utkast otherUtkast = createUtkast("otherId", 1L, INTYG_TYPE, UtkastStatus.SIGNED, "", null, "otherEnhet", PERSON_ID);
otherUtkast.setSignatur(new Signatur());
when(mockUtkastRepository.findAllByPatientPersonnummerAndIntygsTypIn(any(String.class), anySet())).thenReturn(ImmutableList.of(otherUtkast));
try {
intygSignatureService.serverSignature(INTYG_ID, completedUtkast.getVersion());
} catch (WebCertServiceException e) {
assertEquals(WebCertServiceErrorCodeEnum.INVALID_STATE_INTYG_EXISTS, e.getErrorCode());
}
}
use of se.inera.intyg.webcert.persistence.utkast.model.Utkast in project webcert by sklintyg.
the class GrpSignaturServiceTest method buildUtkast.
private Utkast buildUtkast() {
Utkast utkast = new Utkast();
utkast.setIntygsId(INTYG_ID);
utkast.setIntygsTyp("fk7263");
utkast.setStatus(UtkastStatus.DRAFT_COMPLETE);
utkast.setVersion(VERSION);
return utkast;
}
use of se.inera.intyg.webcert.persistence.utkast.model.Utkast in project webcert by sklintyg.
the class UtkastServiceImplTest method createUtkast.
private Utkast createUtkast(String intygId, long version, String type, UtkastStatus status, String model, VardpersonReferens vardperson, Personnummer personnummer) {
Utkast utkast = new Utkast();
utkast.setIntygsId(intygId);
utkast.setVersion(version);
utkast.setIntygsTyp(type);
utkast.setStatus(status);
utkast.setModel(model);
utkast.setSkapadAv(vardperson);
utkast.setSenastSparadAv(vardperson);
utkast.setPatientPersonnummer(personnummer);
return utkast;
}
Aggregations