use of se.inera.intyg.common.support.model.common.internal.GrundData in project webcert by sklintyg.
the class UtkastServiceImplTest method testUpdatePatientOnDraftEmptyPatientId.
@Test
public void testUpdatePatientOnDraftEmptyPatientId() throws Exception {
utkast.setEnhetsId(UTKAST_ENHETS_ID);
UpdatePatientOnDraftRequest request = new UpdatePatientOnDraftRequest(null, 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());
}
use of se.inera.intyg.common.support.model.common.internal.GrundData in project webcert by sklintyg.
the class IntygModuleApiControllerTest method setupCertificateData.
@BeforeClass
public static void setupCertificateData() {
utlatande = new Fk7263Utlatande();
utlatande.setId(CERTIFICATE_ID);
utlatande.setTyp(CERTIFICATE_TYPE);
GrundData grundData = new GrundData();
patient = new Patient();
patient.setPersonId(createPnr(PERSON_ID));
patient.setFornamn("Fornamn");
patient.setEfternamn("Efternamn");
grundData.setPatient(patient);
utlatande.setGrundData(grundData);
List<Status> status = new ArrayList<>();
status.add(new Status(CertificateState.RECEIVED, "HSVARD", LocalDateTime.now()));
status.add(new Status(CertificateState.SENT, "FKASSA", LocalDateTime.now()));
}
use of se.inera.intyg.common.support.model.common.internal.GrundData in project webcert by sklintyg.
the class SignaturServiceImplTest method setup.
@Before
public void setup() throws Exception {
hoSPerson = new HoSPersonal();
hoSPerson.setPersonId("AAA");
hoSPerson.setFullstandigtNamn("Dr Dengroth");
VardpersonReferens vardperson = new VardpersonReferens();
vardperson.setHsaId(hoSPerson.getPersonId());
vardperson.setNamn(hoSPerson.getFullstandigtNamn());
utkast = createUtkast(INTYG_ID, 1, INTYG_TYPE, UtkastStatus.DRAFT_INCOMPLETE, INTYG_JSON, vardperson, ENHET_ID, PERSON_ID);
completedUtkast = createUtkast(INTYG_ID, 2, INTYG_TYPE, UtkastStatus.DRAFT_COMPLETE, INTYG_JSON, vardperson, ENHET_ID, PERSON_ID);
signedUtkast = createUtkast(INTYG_ID, 3, INTYG_TYPE, UtkastStatus.SIGNED, INTYG_JSON, vardperson, ENHET_ID, PERSON_ID);
vardenhet = new Vardenhet(ENHET_ID, "testNamn");
vardgivare = new Vardgivare("123", "vardgivare");
vardgivare.setVardenheter(Collections.singletonList(vardenhet));
user = createWebCertUser(true);
when(webcertUserService.getUser()).thenReturn(user);
when(moduleRegistry.getModuleApi(any())).thenReturn(moduleApi);
when(moduleApi.updateBeforeSigning(any(), any(), any())).thenReturn(INTYG_JSON);
Utlatande utlatande = mock(Utlatande.class);
GrundData grunddata = new GrundData();
grunddata.setSkapadAv(new HoSPersonal());
when(utlatande.getGrundData()).thenReturn(grunddata);
when(moduleApi.getUtlatandeFromJson(anyString())).thenReturn(utlatande);
setTypedField(intygSignatureService, new SignaturTicketTracker());
pagaendeSignering = mock(PagaendeSignering.class);
when(pagaendeSignering.getInternReferens()).thenReturn(PAGAENDE_SIGN_ID);
when(pagaendeSignering.getIntygData()).thenReturn(INTYG_JSON);
when(pagaendeSignering.getIntygsId()).thenReturn(INTYG_ID);
when(pagaendeSignering.getSigneradAvHsaId()).thenReturn(hoSPerson.getPersonId());
when(pagaendeSignering.getSigneradAvNamn()).thenReturn(hoSPerson.getFullstandigtNamn());
when(pagaendeSigneringRepository.findOne(any())).thenReturn(pagaendeSignering);
when(pagaendeSigneringRepository.save(any(PagaendeSignering.class))).thenReturn(pagaendeSignering);
}
Aggregations