use of se.inera.intyg.common.support.model.common.internal.Patient in project webcert by sklintyg.
the class IntygServiceTest method testThatIncompletePatientAddressIsNotUsed.
@Test
public void testThatIncompletePatientAddressIsNotUsed() throws Exception {
// Given
String postadress = "ttipafpinu-postadress";
String postort = null;
String postnummer = null;
Patient patientWithIncompleteAddress = buildPatient(false, false);
patientWithIncompleteAddress.setPostadress(postadress);
patientWithIncompleteAddress.setPostort(postort);
patientWithIncompleteAddress.setPostnummer(postnummer);
when(patientDetailsResolver.resolvePatient(any(Personnummer.class), anyString())).thenReturn(patientWithIncompleteAddress);
// When
IntygContentHolder intygData = intygService.fetchIntygData(CERTIFICATE_ID, CERTIFICATE_TYPE, false);
// Then
ArgumentCaptor<Patient> argumentCaptor = ArgumentCaptor.forClass(Patient.class);
verify(moduleApi).updateBeforeSave(anyString(), argumentCaptor.capture());
assertNotEquals(postadress, argumentCaptor.getValue().getPostadress());
}
use of se.inera.intyg.common.support.model.common.internal.Patient in project webcert by sklintyg.
the class IntygServiceTest method testThatIncompletePatientAddressIsNotUsedWhenIntygtjanstIsUnavailable.
@Test
public void testThatIncompletePatientAddressIsNotUsedWhenIntygtjanstIsUnavailable() throws Exception {
// Given
when(moduleFacade.getCertificate(anyString(), anyString())).thenThrow(new WebServiceException());
when(utkastRepository.findOneByIntygsIdAndIntygsTyp(anyString(), anyString())).thenReturn(getIntyg(CERTIFICATE_ID, LocalDateTime.now(), null));
String postadress = "ttipafpinuwiiu-postadress";
String postort = "";
String postnummer = "";
Patient patientWithIncompleteAddress = buildPatient(false, false);
patientWithIncompleteAddress.setPostadress(postadress);
patientWithIncompleteAddress.setPostort(postort);
patientWithIncompleteAddress.setPostnummer(postnummer);
when(patientDetailsResolver.resolvePatient(any(Personnummer.class), anyString())).thenReturn(patientWithIncompleteAddress);
// When
IntygContentHolder intygData = intygService.fetchIntygData(CERTIFICATE_ID, CERTIFICATE_TYPE, false);
// Then
ArgumentCaptor<Patient> argumentCaptor = ArgumentCaptor.forClass(Patient.class);
verify(moduleApi).updateBeforeSave(anyString(), argumentCaptor.capture());
assertNotEquals(postadress, argumentCaptor.getValue().getPostadress());
}
use of se.inera.intyg.common.support.model.common.internal.Patient in project webcert by sklintyg.
the class CopyUtkastServiceImplTest method setup.
@Before
public void setup() {
hoSPerson = new HoSPersonal();
hoSPerson.setPersonId(HOSPERSON_ID);
hoSPerson.setFullstandigtNamn(HOSPERSON_NAME);
Vardgivare vardgivare = new Vardgivare();
vardgivare.setVardgivarid(VARDGIVARE_ID);
vardgivare.setVardgivarnamn(VARDGIVARE_NAME);
Vardenhet vardenhet = new Vardenhet();
vardenhet.setEnhetsid(VARDENHET_ID);
vardenhet.setEnhetsnamn(VARDENHET_NAME);
vardenhet.setVardgivare(vardgivare);
hoSPerson.setVardenhet(vardenhet);
patient = new Patient();
patient.setPersonId(PATIENT_SSN);
}
use of se.inera.intyg.common.support.model.common.internal.Patient in project webcert by sklintyg.
the class PatientDetailsResolverTest method testFKIntygFristaendeWithPuOk.
/**
* FK - fristående, fungerande PU.
*/
@Test
public void testFKIntygFristaendeWithPuOk() {
when(puService.getPerson(any(Personnummer.class))).thenReturn(buildPersonSvar());
when(webCertUserService.getUser()).thenReturn(freeWebCertUser);
Patient patient = testee.resolvePatient(PNR, "luae_fs");
assertEquals(PNR, patient.getPersonId());
assertEquals(FNAMN, patient.getFornamn());
assertEquals(MNAMN, patient.getMellannamn());
assertEquals(LNAMN, patient.getEfternamn());
assertNull(patient.getPostadress());
assertNull(patient.getPostnummer());
assertNull(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 testTSIntygIntegrationWithPuUnavailable.
/**
* TS + integration + EJ PU, allt som går skall hämtas från parametrar.
*/
@Test
public void testTSIntygIntegrationWithPuUnavailable() {
when(puService.getPerson(any(Personnummer.class))).thenReturn(buildErrorPersonSvar());
when(webCertUserService.getUser()).thenReturn(integratedWebCertUser);
Patient patient = testee.resolvePatient(PNR, "ts-bas");
assertEquals(PNR, patient.getPersonId());
assertEquals(INTEGR_FNAMN, patient.getFornamn());
assertEquals(INTEGR_MNAMN, patient.getMellannamn());
assertEquals(INTEGR_LNAMN, patient.getEfternamn());
assertEquals(INTEGR_POST_ADDR, patient.getPostadress());
assertEquals(INTEGR_POST_NR, patient.getPostnummer());
assertEquals(INTEGR_POST_ORT, patient.getPostort());
assertEquals(INTEGR_AVLIDEN, patient.isAvliden());
assertEquals(false, patient.isSekretessmarkering());
}
Aggregations