use of se.inera.intyg.common.support.model.common.internal.HoSPersonal in project webcert by sklintyg.
the class CopyCompletionUtkastBuilderTest 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.HoSPersonal in project webcert by sklintyg.
the class CreateRenewalCopyUtkastBuilderImplTest 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.HoSPersonal in project webcert by sklintyg.
the class CreateUtkastFromTemplateBuilderTest 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.HoSPersonal in project webcert by sklintyg.
the class UtkastServiceImplTest method testSaveDraftSecondSave.
@Test
public void testSaveDraftSecondSave() throws Exception {
ValidationMessage valMsg = new ValidationMessage("a.category", "a.field.somewhere", ValidationMessageType.OTHER, "This is soooo wrong!");
ValidateDraftResponse validationResponse = new ValidateDraftResponse(ValidationStatus.INVALID, Collections.singletonList(valMsg));
WebCertUser user = createUser();
Utlatande utlatande = mock(Utlatande.class);
GrundData grunddata = new GrundData();
grunddata.setSkapadAv(new HoSPersonal());
grunddata.setPatient(defaultPatient);
when(utlatande.getGrundData()).thenReturn(grunddata);
when(mockUtkastRepository.findOne(INTYG_ID)).thenReturn(utkast);
when(moduleRegistry.getModuleApi(INTYG_TYPE)).thenReturn(mockModuleApi);
when(mockModuleApi.validateDraft(anyString())).thenReturn(validationResponse);
when(mockModuleApi.getUtlatandeFromJson(anyString())).thenReturn(utlatande);
when(mockUtkastRepository.save(utkast)).thenReturn(utkast);
when(mockModuleApi.shouldNotify(any(String.class), any(String.class))).thenReturn(true);
when(userService.getUser()).thenReturn(user);
when(mockModuleApi.updateBeforeSave(anyString(), any(HoSPersonal.class))).thenReturn("{}");
SaveDraftResponse res = draftService.saveDraft(INTYG_ID, UTKAST_VERSION, INTYG_JSON, false);
verify(mockUtkastRepository).save(any(Utkast.class));
// Assert notification message
verify(notificationService).sendNotificationForDraftChanged(any(Utkast.class));
// Assert that no logs are called
verifyZeroInteractions(logService);
verifyZeroInteractions(mockMonitoringService);
assertNotNull("An DraftValidation should be returned", res);
assertEquals("Validation should fail", UtkastStatus.DRAFT_INCOMPLETE, res.getStatus());
}
use of se.inera.intyg.common.support.model.common.internal.HoSPersonal in project webcert by sklintyg.
the class UtkastServiceImplTest method testUpdatePatientOnDraftSamePatientId.
@Test
public void testUpdatePatientOnDraftSamePatientId() throws Exception {
utkast.setEnhetsId(UTKAST_ENHETS_ID);
UpdatePatientOnDraftRequest request = new UpdatePatientOnDraftRequest(defaultPatient.getPersonId(), utkast.getIntygsId(), utkast.getVersion());
WebCertUser user = createUser();
Utlatande utlatande = mock(Utlatande.class);
GrundData grunddata = new GrundData();
grunddata.setPatient(defaultPatient);
grunddata.setSkapadAv(new HoSPersonal());
when(utlatande.getGrundData()).thenReturn(grunddata);
// Make a spy out of the utkast so we can verify invocations on the setters with proper names further down.
utkast = spy(utkast);
when(mockUtkastRepository.findOne(INTYG_ID)).thenReturn(utkast);
when(moduleRegistry.getModuleApi(INTYG_TYPE)).thenReturn(mockModuleApi);
when(mockModuleApi.getUtlatandeFromJson(anyString())).thenReturn(utlatande);
when(userService.getUser()).thenReturn(user);
draftService.updatePatientOnDraft(request);
verify(mockUtkastRepository, never()).save(any(Utkast.class));
verify(notificationService, never()).sendNotificationForDraftChanged(any(Utkast.class));
verify(utkast, never()).setPatientPersonnummer(any(Personnummer.class));
assertEquals(defaultPatient.getPersonId().getPersonnummer(), user.getParameters().getBeforeAlternateSsn());
}
Aggregations