use of se.inera.intyg.common.support.model.common.internal.Patient in project webcert by sklintyg.
the class PatientDetailsResolverTest method testSosDoiIntygFristaendeWithNoDBIntygAndPuOk.
/**
* DOI - Fristående. DB saknas, PU finns. Namn och adress från PU.
*/
@Test
public void testSosDoiIntygFristaendeWithNoDBIntygAndPuOk() throws ModuleNotFoundException, IOException {
when(puService.getPerson(any(Personnummer.class))).thenReturn(buildPersonSvar());
when(webCertUserService.getUser()).thenReturn(freeWebCertUser);
when(freeWebCertUser.getValdVardenhet()).thenReturn(buildVardenhet());
Patient patient = testee.resolvePatient(PNR, "doi");
assertEquals(PNR.getPersonnummer(), patient.getPersonId().getPersonnummer());
assertEquals(FNAMN, patient.getFornamn());
assertEquals(MNAMN, patient.getMellannamn());
assertEquals(LNAMN, patient.getEfternamn());
assertEquals(POST_ADDR, patient.getPostadress());
assertEquals(POST_NR, patient.getPostnummer());
assertEquals(POST_ORT, patient.getPostort());
assertEquals(PU_AVLIDEN, patient.isAvliden());
assertEquals(false, patient.isSekretessmarkering());
}
use of se.inera.intyg.common.support.model.common.internal.Patient in project webcert by sklintyg.
the class PatientDetailsResolverTest method testTSIntygFristaendeWithPuOk.
/**
* TS + fristående + PU == Allt från PU
*/
@Test
public void testTSIntygFristaendeWithPuOk() {
when(puService.getPerson(any(Personnummer.class))).thenReturn(buildPersonSvar());
when(webCertUserService.getUser()).thenReturn(freeWebCertUser);
Patient patient = testee.resolvePatient(PNR, "ts-bas");
assertEquals(PNR, patient.getPersonId());
assertEquals(FNAMN, patient.getFornamn());
assertEquals(MNAMN, patient.getMellannamn());
assertEquals(LNAMN, patient.getEfternamn());
assertEquals(POST_ADDR, patient.getPostadress());
assertEquals(POST_NR, patient.getPostnummer());
assertEquals(POST_ORT, patient.getPostort());
assertEquals(PU_AVLIDEN, patient.isAvliden());
assertEquals(false, patient.isSekretessmarkering());
}
use of se.inera.intyg.common.support.model.common.internal.Patient in project webcert by sklintyg.
the class PatientDetailsResolverTest method testTSIntygIntegrationWithPuOkButAddressMissingFromIntegration.
/**
* TS - integration - PU: Namn + meta från PU, adress från PU
*/
@Test
public void testTSIntygIntegrationWithPuOkButAddressMissingFromIntegration() {
when(puService.getPerson(any(Personnummer.class))).thenReturn(buildPersonSvar());
when(webCertUserService.getUser()).thenReturn(integratedWebCertUser);
when(integratedWebCertUser.getParameters()).thenReturn(buildIntegrationParametersWithNullAddress());
Patient patient = testee.resolvePatient(PNR, "ts-bas");
assertEquals(PNR, patient.getPersonId());
assertEquals(FNAMN, patient.getFornamn());
assertEquals(MNAMN, patient.getMellannamn());
assertEquals(LNAMN, patient.getEfternamn());
assertEquals(POST_ADDR, patient.getPostadress());
assertEquals(POST_NR, patient.getPostnummer());
assertEquals(POST_ORT, patient.getPostort());
assertEquals(PU_AVLIDEN || INTEGR_AVLIDEN, patient.isAvliden());
assertEquals(false, patient.isSekretessmarkering());
}
use of se.inera.intyg.common.support.model.common.internal.Patient in project webcert by sklintyg.
the class PatientDetailsResolverTest method testSOSDBIntygFristaendeWithPuUnavailable.
/**
* Dödsbevis + fristående + EJ PU == null
*/
@Test
public void testSOSDBIntygFristaendeWithPuUnavailable() {
when(puService.getPerson(any(Personnummer.class))).thenReturn(buildErrorPersonSvar());
when(webCertUserService.getUser()).thenReturn(freeWebCertUser);
Patient patient = testee.resolvePatient(PNR, "db");
assertNull(patient);
}
use of se.inera.intyg.common.support.model.common.internal.Patient in project webcert by sklintyg.
the class PatientDetailsResolverTest method testSosDoiIntygIntegrationWithNoDBIntygAndPuUnavailable.
/**
* DOI - Integration. DB saknas, PU saknas == Ingen info
*/
@Test
public void testSosDoiIntygIntegrationWithNoDBIntygAndPuUnavailable() throws ModuleNotFoundException, IOException {
when(puService.getPerson(any(Personnummer.class))).thenReturn(buildErrorPersonSvar());
when(webCertUserService.getUser()).thenReturn(integratedWebCertUser);
when(integratedWebCertUser.getValdVardgivare()).thenReturn(new Vardgivare("vg-1", "vardgivare-1"));
List<Utkast> drafts = new ArrayList<>();
when(utkastRepository.findDraftsByPatientAndVardgivareAndStatus(anyString(), anyString(), anyList(), anySet())).thenReturn(drafts);
Patient patient = testee.resolvePatient(PNR, "doi");
assertNull(patient);
}
Aggregations