use of se.inera.intyg.webcert.web.integration.validators.ResultValidator in project webcert by sklintyg.
the class CreateDraftCertificateResponderImplTest method testCreateDraftCertificateVardenhetAlredyExistsInRegistry.
@Test
public void testCreateDraftCertificateVardenhetAlredyExistsInRegistry() {
CreateNewDraftRequest draftRequest = createCreateNewDraftRequest(createVardenhet(createVardgivare()));
CreateDraftCertificateType certificateType = createCertificateType();
VardpersonReferens vardperson = createVardpersonReferens(certificateType.getIntyg().getSkapadAv().getPersonalId().getRoot(), certificateType.getIntyg().getSkapadAv().getFullstandigtNamn());
Utkast utkast = createUtkast(UTKAST_ID, Long.parseLong(UTKAST_VERSION), UTKAST_TYPE, UtkastStatus.DRAFT_INCOMPLETE, UTKAST_JSON, vardperson);
when(mockValidator.validate(any(Intyg.class))).thenReturn(new ResultValidator());
when(mockRequestBuilder.buildCreateNewDraftRequest(any(Intyg.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()));
CreateDraftCertificateResponseType response = responder.createDraftCertificate(LOGICAL_ADDR, certificateType);
verify(mockUtkastService).createNewDraft(any(CreateNewDraftRequest.class));
verify(mockIntegreradeEnheterService).putIntegreradEnhet(any(IntegreradEnhetEntry.class), eq(false), eq(true));
assertNotNull(response);
assertEquals(response.getResult().getResultCode(), ResultCodeType.OK);
assertEquals(response.getIntygsId().getExtension(), UTKAST_ID);
}
use of se.inera.intyg.webcert.web.integration.validators.ResultValidator in project webcert by sklintyg.
the class CreateDraftCertificateValidatorImplTest method testValidateHoSPersonalEnhetMissing.
@Test
public void testValidateHoSPersonalEnhetMissing() {
ResultValidator result = validator.validate(buildIntyg(LUSE, "efternamn", "fornamn", "fullständigt namn", "enhetsId", "enhetsnamn", false));
assertTrue(result.hasErrors());
}
use of se.inera.intyg.webcert.web.integration.validators.ResultValidator in project webcert by sklintyg.
the class CreateDraftCertificateValidatorImplTest method testValidate.
@Test
public void testValidate() {
ResultValidator result = validator.validate(buildIntyg(LUSE, "efternamn", "förnamn", "fullständigt namn", "enhetsId", "enhetsnamn", true));
assertFalse(result.hasErrors());
}
use of se.inera.intyg.webcert.web.integration.validators.ResultValidator in project webcert by sklintyg.
the class CreateDraftCertificateValidatorImplTest method testValidatePatientSamordningsnummerOk.
@Test
public void testValidatePatientSamordningsnummerOk() {
ResultValidator result = validator.validate(buildIntyg(LUSE, "efternamn", "förnamn", "fullständigt namn", "enhetsId", "enhetsnamn", true, "198001910002"));
assertFalse(result.hasErrors());
}
use of se.inera.intyg.webcert.web.integration.validators.ResultValidator in project webcert by sklintyg.
the class CreateDraftCertificateValidatorImplTest method testValidationOfPersonnummerDoesNotExistInPU.
@Test
public void testValidationOfPersonnummerDoesNotExistInPU() {
when(patientDetailsResolver.getPersonFromPUService(any(Personnummer.class))).thenReturn(buildPersonSvar(PersonSvar.Status.NOT_FOUND));
ResultValidator result = validator.validateApplicationErrors(buildIntyg(TSBAS, "efternamn", "förnamn", "fullständigt namn", "enhetsId", "enhetsnamn", true), user);
assertTrue(result.hasErrors());
verify(patientDetailsResolver).getPersonFromPUService(any(Personnummer.class));
}
Aggregations