use of se.inera.intyg.webcert.persistence.utkast.model.VardpersonReferens in project webcert by sklintyg.
the class IntygDraftsConverterTest method createUtkast.
private Utkast createUtkast() {
final String sparadAvNamn = "namn efternamn";
final String sparadAvHsaId = "hsaid";
final String skapadAvHsaId = "hsaid";
VardpersonReferens vardpersonReferens = new VardpersonReferens();
Utkast utkast = new Utkast();
utkast.setStatus(UtkastStatus.DRAFT_INCOMPLETE);
utkast.setSenastSparadAv(vardpersonReferens);
utkast.getSenastSparadAv().setNamn(sparadAvNamn);
utkast.getSenastSparadAv().setHsaId(sparadAvHsaId);
utkast.setSkapadAv(vardpersonReferens);
utkast.getSkapadAv().setHsaId(skapadAvHsaId);
utkast.setPatientPersonnummer(Personnummer.createPersonnummer("20121212-1211").get());
Signatur signatur = mock(Signatur.class);
utkast.setSignatur(signatur);
when(signatur.getSigneradAv()).thenReturn(sparadAvHsaId);
return utkast;
}
use of se.inera.intyg.webcert.persistence.utkast.model.VardpersonReferens in project webcert by sklintyg.
the class CreateDraftCertificateResponderImplTest method whenNewCertificateDraftSuccessResponse.
/**
* When a new certificate draft is being created the caller
* should get a success response returned and any stakeholder
* should be notified with a notification message.
*/
@Test
public void whenNewCertificateDraftSuccessResponse() {
// Given
ResultValidator resultsValidator = new ResultValidator();
Vardgivare vardgivare = createVardgivare();
Vardenhet vardenhet = createVardenhet(vardgivare);
CreateNewDraftRequest draftRequest = createCreateNewDraftRequest(vardenhet);
CreateDraftCertificateType certificateType = createCertificateType();
VardpersonReferens vardperson = createVardpersonReferens(certificateType.getUtlatande().getSkapadAv().getPersonalId().getRoot(), certificateType.getUtlatande().getSkapadAv().getFullstandigtNamn());
Utkast utkast = createUtkast(UTKAST_ID, Long.parseLong(UTKAST_VERSION), UTKAST_TYPE, UtkastStatus.DRAFT_INCOMPLETE, UTKAST_JSON, vardperson);
// When
when(mockValidator.validate(any(Utlatande.class))).thenReturn(resultsValidator);
when(mockRequestBuilder.buildCreateNewDraftRequest(any(Utlatande.class), any(IntygUser.class))).thenReturn(draftRequest);
when(mockUtkastService.createNewDraft(any(CreateNewDraftRequest.class))).thenReturn(utkast);
when(takService.verifyTakningForCareUnit(any(String.class), any(String.class), any(SchemaVersion.class), any(IntygUser.class))).thenReturn(new TakResult(true, Lists.emptyList()));
// Then
CreateDraftCertificateResponseType response = responder.createDraftCertificate(LOGICAL_ADDR, certificateType);
verify(mockUtkastService).createNewDraft(any(CreateNewDraftRequest.class));
verify(mockIntegreradeEnheterService).putIntegreradEnhet(any(IntegreradEnhetEntry.class), eq(true), eq(false));
verify(takService).verifyTakningForCareUnit(any(String.class), any(String.class), any(SchemaVersion.class), any(IntygUser.class));
// Assert response content
assertNotNull(response);
assertEquals(response.getResult().getResultCode(), ResultCodeType.OK);
assertEquals(response.getUtlatandeId().getExtension(), UTKAST_ID);
}
use of se.inera.intyg.webcert.persistence.utkast.model.VardpersonReferens in project webcert by sklintyg.
the class CreateDraftCertificateResponderImplTest method createVardpersonReferens.
private VardpersonReferens createVardpersonReferens(String hsaId, String name) {
VardpersonReferens vardperson = new VardpersonReferens();
vardperson.setHsaId(hsaId);
vardperson.setNamn(name);
return vardperson;
}
Aggregations