Search in sources :

Example 6 with Patient

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());
}
Also used : Personnummer(se.inera.intyg.schemas.contract.Personnummer) IntygContentHolder(se.inera.intyg.webcert.web.service.intyg.dto.IntygContentHolder) Patient(se.inera.intyg.common.support.model.common.internal.Patient) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) Test(org.junit.Test)

Example 7 with Patient

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());
}
Also used : Personnummer(se.inera.intyg.schemas.contract.Personnummer) WebServiceException(javax.xml.ws.WebServiceException) IntygContentHolder(se.inera.intyg.webcert.web.service.intyg.dto.IntygContentHolder) Patient(se.inera.intyg.common.support.model.common.internal.Patient) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) Test(org.junit.Test)

Example 8 with Patient

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);
}
Also used : HoSPersonal(se.inera.intyg.common.support.model.common.internal.HoSPersonal) Patient(se.inera.intyg.common.support.model.common.internal.Patient) Vardgivare(se.inera.intyg.common.support.model.common.internal.Vardgivare) Vardenhet(se.inera.intyg.common.support.model.common.internal.Vardenhet) Before(org.junit.Before)

Example 9 with Patient

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());
}
Also used : Personnummer(se.inera.intyg.schemas.contract.Personnummer) Patient(se.inera.intyg.common.support.model.common.internal.Patient) Test(org.junit.Test)

Example 10 with Patient

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());
}
Also used : Personnummer(se.inera.intyg.schemas.contract.Personnummer) Patient(se.inera.intyg.common.support.model.common.internal.Patient) Test(org.junit.Test)

Aggregations

Patient (se.inera.intyg.common.support.model.common.internal.Patient)62 Test (org.junit.Test)28 Personnummer (se.inera.intyg.schemas.contract.Personnummer)28 Utkast (se.inera.intyg.webcert.persistence.utkast.model.Utkast)12 HoSPersonal (se.inera.intyg.common.support.model.common.internal.HoSPersonal)11 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)7 Utlatande (se.inera.intyg.common.support.model.common.internal.Utlatande)7 Vardenhet (se.inera.intyg.common.support.model.common.internal.Vardenhet)6 ModuleApi (se.inera.intyg.common.support.modules.support.api.ModuleApi)6 ArrayList (java.util.ArrayList)5 Before (org.junit.Before)5 Vardgivare (se.inera.intyg.common.support.model.common.internal.Vardgivare)5 Vardgivare (se.inera.intyg.infra.integration.hsa.model.Vardgivare)5 IntygContentHolder (se.inera.intyg.webcert.web.service.intyg.dto.IntygContentHolder)5 Relations (se.inera.intyg.webcert.web.web.controller.api.dto.Relations)5 IOException (java.io.IOException)4 GrundData (se.inera.intyg.common.support.model.common.internal.GrundData)4 ModuleNotFoundException (se.inera.intyg.common.support.modules.registry.ModuleNotFoundException)4 ModuleException (se.inera.intyg.common.support.modules.support.api.exception.ModuleException)4 PersonSvar (se.inera.intyg.infra.integration.pu.model.PersonSvar)4