use of com.b2international.snowowl.fhir.core.exceptions.ValidationException in project snow-owl by b2ihealthcare.
the class ExtensionTest method buildInvalid.
@Test
public void buildInvalid() {
ValidationException exception = assertThrows(ValidationException.class, () -> {
IntegerExtension.builder().url("ID").addExtension(IntegerExtension.builder().url("ID2").value(2).build()).value(1).build();
});
assertEquals("1 validation error", exception.getMessage());
Issue expectedIssue = validationErrorIssueBuilder.addLocation("IntegerExtension.valid").detailsWithDisplay(OperationOutcomeCode.MSG_PARAM_INVALID, "Parameter 'valid' content is invalid [false]. " + "Violation: An extension SHALL have either a value (i.e. a value[x] element) or sub-extensions.").build();
assertThat(exception, FhirExceptionIssueMatcher.issue(expectedIssue));
}
use of com.b2international.snowowl.fhir.core.exceptions.ValidationException in project snow-owl by b2ihealthcare.
the class IssueTest method buildInvalid.
@Test
public void buildInvalid() {
ValidationException exception = assertThrows(ValidationException.class, () -> {
Instant.builder().build();
});
assertEquals("1 validation error", exception.getMessage());
Issue expectedIssue = validationErrorIssueBuilder.addLocation("Instant.instant").detailsWithDisplay(OperationOutcomeCode.MSG_PARAM_INVALID, "Parameter 'instant' content is invalid [null]. Violation: may not be null.").build();
assertThat(exception, FhirExceptionIssueMatcher.issue(expectedIssue));
}
use of com.b2international.snowowl.fhir.core.exceptions.ValidationException in project snow-owl by b2ihealthcare.
the class BundleEntryTest method buildInvalidParametersEntry.
@Test
public void buildInvalidParametersEntry() {
ValidationException exception = assertThrows(ValidationException.class, () -> {
LookupRequest lookupRequest = LookupRequest.builder().code("23245-4").system("http://loinc.org").build();
Json json1 = new Parameters.Json(lookupRequest);
ParametersRequestEntry entry = ParametersRequestEntry.builder().request(BatchRequest.createGetRequest("CodeSystem/$lookup")).resource(new Parameters.Fhir(json1.parameters())).build();
});
Issue expectedIssue = validationErrorIssueBuilder.addLocation("ParametersRequestEntry.post").detailsWithDisplay(OperationOutcomeCode.MSG_PARAM_INVALID, "Parameter 'post' content is invalid [false]. Violation: Only POST requests can be parameter-based.").build();
assertThat(exception, FhirExceptionIssueMatcher.issue(expectedIssue));
}
Aggregations