use of se.inera.intyg.webcert.web.service.utkast.dto.CreateRenewalCopyRequest in project webcert by sklintyg.
the class CreateRenewalCopyUtkastBuilderImplTest method testPopulateRenewalUtkastFromSignedIntygEnforceVardenhet.
@Test(expected = WebCertServiceException.class)
public void testPopulateRenewalUtkastFromSignedIntygEnforceVardenhet() throws Exception {
IntygContentHolder ich = createIntygContentHolder();
when(mockIntygService.fetchIntygData(INTYG_ID, INTYG_TYPE, true)).thenReturn(ich);
CreateRenewalCopyRequest renewalRequest = buildRenewalRequest();
Person patientDetails = new Person(PATIENT_SSN, false, false, PATIENT_FNAME, PATIENT_MNAME, PATIENT_LNAME, "Postadr", "12345", "postort");
renewalBuilder.populateCopyUtkastFromSignedIntyg(renewalRequest, patientDetails, false, true, true);
}
use of se.inera.intyg.webcert.web.service.utkast.dto.CreateRenewalCopyRequest in project webcert by sklintyg.
the class CreateRenewalCopyUtkastBuilderImplTest method testPopulateRenewalUtkastFromSignedIntygWithNoPatientDetails.
@Test
public void testPopulateRenewalUtkastFromSignedIntygWithNoPatientDetails() throws Exception {
IntygContentHolder ich = createIntygContentHolder();
when(mockIntygService.fetchIntygData(INTYG_ID, INTYG_TYPE, false)).thenReturn(ich);
CreateRenewalCopyRequest renewalRequest = buildRenewalRequest();
when(mockModuleApi.createRenewalFromTemplate(any(CreateDraftCopyHolder.class), any())).thenReturn(INTYG_JSON);
ValidateDraftResponse vdr = new ValidateDraftResponse(ValidationStatus.VALID, new ArrayList<>());
when(mockModuleApi.validateDraft(anyString())).thenReturn(vdr);
CopyUtkastBuilderResponse builderResponse = renewalBuilder.populateCopyUtkastFromSignedIntyg(renewalRequest, null, false, false, false);
assertNotNull(builderResponse.getUtkastCopy());
assertNotNull(builderResponse.getUtkastCopy().getModel());
assertEquals(INTYG_TYPE, builderResponse.getUtkastCopy().getIntygsTyp());
assertEquals(PATIENT_SSN, builderResponse.getUtkastCopy().getPatientPersonnummer());
assertEquals("Test", builderResponse.getUtkastCopy().getPatientFornamn());
assertNull(builderResponse.getUtkastCopy().getPatientMellannamn());
assertEquals("Testorsson", builderResponse.getUtkastCopy().getPatientEfternamn());
}
use of se.inera.intyg.webcert.web.service.utkast.dto.CreateRenewalCopyRequest in project webcert by sklintyg.
the class CreateRenewalCopyUtkastBuilderImplTest method testPopulateRenewalUtkastFromOriginal.
@Test
public void testPopulateRenewalUtkastFromOriginal() throws Exception {
Utkast orgUtkast = createOriginalUtkast();
when(mockUtkastRepository.findOne(INTYG_ID)).thenReturn(orgUtkast);
CreateRenewalCopyRequest renewalRequest = buildRenewalRequest();
Person patientDetails = new Person(PATIENT_SSN, false, false, PATIENT_FNAME, PATIENT_MNAME, PATIENT_LNAME, "Postadr", "12345", "postort");
when(mockModuleApi.createRenewalFromTemplate(any(CreateDraftCopyHolder.class), any())).thenReturn(INTYG_JSON);
ValidateDraftResponse vdr = new ValidateDraftResponse(ValidationStatus.VALID, new ArrayList<>());
when(mockModuleApi.validateDraft(anyString())).thenReturn(vdr);
CopyUtkastBuilderResponse builderResponse = renewalBuilder.populateCopyUtkastFromOrignalUtkast(renewalRequest, patientDetails, false, false, false);
assertNotNull(builderResponse.getUtkastCopy());
assertNotNull(builderResponse.getUtkastCopy().getModel());
assertEquals(INTYG_TYPE, builderResponse.getUtkastCopy().getIntygsTyp());
assertEquals(PATIENT_SSN, builderResponse.getUtkastCopy().getPatientPersonnummer());
assertEquals(PATIENT_FNAME, builderResponse.getUtkastCopy().getPatientFornamn());
assertNotNull(builderResponse.getUtkastCopy().getPatientMellannamn());
assertEquals(PATIENT_LNAME, builderResponse.getUtkastCopy().getPatientEfternamn());
}
use of se.inera.intyg.webcert.web.service.utkast.dto.CreateRenewalCopyRequest in project webcert by sklintyg.
the class CreateRenewalCopyUtkastBuilderImplTest method testPopulateRenewalUtkastFromOriginalEnforceVardenhet.
@Test(expected = WebCertServiceException.class)
public void testPopulateRenewalUtkastFromOriginalEnforceVardenhet() throws Exception {
Utkast orgUtkast = createOriginalUtkast();
orgUtkast.setEnhetsId("OTHER_ID");
when(mockUtkastRepository.findOne(INTYG_ID)).thenReturn(orgUtkast);
CreateRenewalCopyRequest renewalRequest = buildRenewalRequest();
Person patientDetails = new Person(PATIENT_SSN, false, false, PATIENT_FNAME, PATIENT_MNAME, PATIENT_LNAME, "Postadr", "12345", "postort");
renewalBuilder.populateCopyUtkastFromOrignalUtkast(renewalRequest, patientDetails, false, true, true);
}
use of se.inera.intyg.webcert.web.service.utkast.dto.CreateRenewalCopyRequest in project webcert by sklintyg.
the class CreateRenewalCopyUtkastBuilderImplTest method testPopulateRenewalUtkastFromOriginalWhenIntegratedAndWithUpdatedSSN.
@Test
public void testPopulateRenewalUtkastFromOriginalWhenIntegratedAndWithUpdatedSSN() throws Exception {
Utkast orgUtkast = createOriginalUtkast();
when(mockUtkastRepository.findOne(INTYG_ID)).thenReturn(orgUtkast);
CreateRenewalCopyRequest renewalRequest = buildRenewalRequest();
renewalRequest.setNyttPatientPersonnummer(PATIENT_NEW_SSN);
renewalRequest.setDjupintegrerad(true);
when(mockModuleApi.createRenewalFromTemplate(any(CreateDraftCopyHolder.class), any())).thenReturn(INTYG_JSON);
ValidateDraftResponse vdr = new ValidateDraftResponse(ValidationStatus.VALID, new ArrayList<>());
when(mockModuleApi.validateDraft(anyString())).thenReturn(vdr);
CopyUtkastBuilderResponse builderResponse = renewalBuilder.populateCopyUtkastFromOrignalUtkast(renewalRequest, null, false, false, false);
assertNotNull(builderResponse.getUtkastCopy());
assertNotNull(builderResponse.getUtkastCopy().getModel());
assertEquals(INTYG_TYPE, builderResponse.getUtkastCopy().getIntygsTyp());
assertEquals(PATIENT_NEW_SSN, builderResponse.getUtkastCopy().getPatientPersonnummer());
assertEquals(PATIENT_FNAME, builderResponse.getUtkastCopy().getPatientFornamn());
assertNotNull(builderResponse.getUtkastCopy().getPatientMellannamn());
assertEquals(PATIENT_LNAME, builderResponse.getUtkastCopy().getPatientEfternamn());
}
Aggregations