use of uk.gov.justice.services.core.json.JsonSchemaValidationException in project microservice_framework by CJSCommonPlatform.
the class BadRequestExceptionMapperTest method shouldAddJsonValidationErrorsToResponse.
@Test
public void shouldAddJsonValidationErrorsToResponse() {
final ValidationException validationException = new ValidationException(schema, "Test Json");
final JsonSchemaValidationException jsonSchemaValidationException = new JsonSchemaValidationException(validationException.getMessage(), validationException);
final BadRequestException badRequestException = new BadRequestException(TEST_ERROR_MESSAGE, jsonSchemaValidationException);
final Response response = exceptionMapper.toResponse(badRequestException);
final String body = response.getEntity().toString();
assertThat(body, hasJsonPath("$.validationErrors.message", equalTo("#: Test Json")));
}
Aggregations