use of se.riv.clinicalprocess.healthcond.certificate.createdraftcertificateresponder.v1.CreateDraftCertificateResponseType in project webcert by sklintyg.
the class CreateDraftCertificateV1IT method testCreateDeprecatedGivesCorrectErrorMessage.
@Test
public void testCreateDeprecatedGivesCorrectErrorMessage() {
Response resp = given().cookie("ROUTEID", ".1").filter(responseBodyExtractorFilter).body(createRequestBody(FK7263, DEFAULT_LAKARE_HSAID)).when().post(CREATE_DRAFT_CERTIFICATE_V1_0).then().statusCode(200).rootPath(BASE).extract().response();
CreateDraftCertificateResponseType responseBody = resp.getBody().as(CreateDraftCertificateResponseType.class);
assertEquals(String.format(DEPRECATED_ERROR_MSG, FK7263), responseBody.getResult().getResultText());
}
use of se.riv.clinicalprocess.healthcond.certificate.createdraftcertificateresponder.v1.CreateDraftCertificateResponseType in project webcert by sklintyg.
the class CreateDraftCertificateV3IT method testCreateDeprecatedGivesCorrectErrorMessage.
@Test
public void testCreateDeprecatedGivesCorrectErrorMessage() {
Response resp = given().cookie("ROUTEID", ".1").filter(responseBodyExtractorFilter).body(createRequestBody(FK7263, DEFAULT_LAKARE_HSAID)).when().post(CREATE_DRAFT_CERTIFICATE_V3_0).then().statusCode(200).rootPath(BASE).extract().response();
CreateDraftCertificateResponseType responseBody = resp.getBody().as(CreateDraftCertificateResponseType.class);
assertEquals(String.format(DEPRECATED_ERROR_MSG, FK7263.toLowerCase()), responseBody.getResult().getResultText());
}
use of se.riv.clinicalprocess.healthcond.certificate.createdraftcertificateresponder.v1.CreateDraftCertificateResponseType in project webcert by sklintyg.
the class CreateDraftCertificateResponderImplTest method testCreateDraftCertificateTakningNotOk.
@Test
public void testCreateDraftCertificateTakningNotOk() {
// Given
ResultValidator resultsValidator = new ResultValidator();
CreateDraftCertificateType certificateType = createCertificateType();
// When
when(mockValidator.validate(any(Utlatande.class))).thenReturn(resultsValidator);
when(takService.verifyTakningForCareUnit(any(String.class), any(String.class), any(SchemaVersion.class), any(IntygUser.class))).thenReturn(new TakResult(false, Lists.newArrayList("Den angivna enheten går ej att adressera för ärendekommunikation.")));
// Then
CreateDraftCertificateResponseType response = responder.createDraftCertificate(LOGICAL_ADDR, certificateType);
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.ERROR);
assertEquals(ErrorIdType.APPLICATION_ERROR, response.getResult().getErrorId());
assertEquals("Den angivna enheten går ej att adressera för ärendekommunikation.", response.getResult().getResultText());
}
use of se.riv.clinicalprocess.healthcond.certificate.createdraftcertificateresponder.v1.CreateDraftCertificateResponseType in project webcert by sklintyg.
the class CreateDraftCertificateResponderImplTest method testCreateDraftCertificateValidationError.
@Test
public void testCreateDraftCertificateValidationError() {
final String validationError = "error";
ResultValidator resultsValidator = new ResultValidator();
resultsValidator.addError(validationError);
CreateDraftCertificateType certificateType = createCertificateType();
when(mockValidator.validate(any(Utlatande.class))).thenReturn(resultsValidator);
CreateDraftCertificateResponseType response = responder.createDraftCertificate(LOGICAL_ADDR, certificateType);
verifyZeroInteractions(mockUtkastService);
verifyZeroInteractions(mockIntegreradeEnheterService);
assertNotNull(response);
assertEquals(response.getResult().getResultCode(), ResultCodeType.ERROR);
assertEquals(ErrorIdType.VALIDATION_ERROR, response.getResult().getErrorId());
assertEquals(validationError, response.getResult().getResultText());
}
use of se.riv.clinicalprocess.healthcond.certificate.createdraftcertificateresponder.v1.CreateDraftCertificateResponseType in project webcert by sklintyg.
the class CreateDraftCertificateResponderImplTest method testCreateDraftCertificateNoMIUs.
@Test
public void testCreateDraftCertificateNoMIUs() {
WebCertUser userWithoutMiu = buildWebCertUser();
userWithoutMiu.setVardgivare(new ArrayList<>());
when(webcertUserDetailsService.loadUserByHsaId(USER_HSAID)).thenReturn(userWithoutMiu);
CreateDraftCertificateType certificateType = createCertificateType();
when(mockValidator.validate(any(Intyg.class))).thenReturn(new ResultValidator());
CreateDraftCertificateResponseType response = responder.createDraftCertificate(LOGICAL_ADDR, certificateType);
verify(mockMonitoringLogService).logMissingMedarbetarUppdrag(USER_HSAID, UNIT_HSAID);
assertNotNull(response);
assertEquals(response.getResult().getResultCode(), ResultCodeType.ERROR);
assertEquals(response.getResult().getErrorId(), ErrorIdType.VALIDATION_ERROR);
}
Aggregations