Search in sources :

Example 6 with Issue

use of com.b2international.snowowl.fhir.core.model.Issue in project snow-owl by b2ihealthcare.

the class PropertySerializationTest method incorrectSubPropertyTest.

@Test
public void incorrectSubPropertyTest() throws Exception {
    Builder builder = Issue.builder().code(IssueType.INVALID).severity(IssueSeverity.ERROR).diagnostics("1 validation error");
    Issue expectedIssue = builder.addLocation("SubProperty.code").detailsWithDisplay(OperationOutcomeCode.MSG_PARAM_INVALID, "Parameter 'code' content is invalid [null]. Violation: may not be null.").build();
    exception.expect(ValidationException.class);
    exception.expectMessage("1 validation error");
    exception.expect(FhirExceptionIssueMatcher.issue(expectedIssue));
    Property.builder().code("123").valueInteger(2).description("propertyDescription").addSubProperty(SubProperty.builder().description("subDescription").valueInteger(1).build()).build();
}
Also used : Issue(com.b2international.snowowl.fhir.core.model.Issue) Builder(com.b2international.snowowl.fhir.core.model.Issue.Builder) FhirTest(com.b2international.snowowl.fhir.tests.FhirTest) Test(org.junit.Test)

Example 7 with Issue

use of com.b2international.snowowl.fhir.core.model.Issue in project snow-owl by b2ihealthcare.

the class PropertySerializationTest method emptyCodeTest.

@Test
public void emptyCodeTest() throws Exception {
    Builder builder = Issue.builder().code(IssueType.INVALID).severity(IssueSeverity.ERROR).diagnostics("1 validation error");
    Issue expectedIssue = builder.addLocation("Property.code.codeValue").detailsWithDisplay(OperationOutcomeCode.MSG_PARAM_INVALID, "Parameter 'code.codeValue' content is invalid []. Violation: must match \"[^\\s]+([\\s]?[^\\s]+)*\".").build();
    exception.expect(ValidationException.class);
    exception.expectMessage("1 validation error");
    exception.expect(FhirExceptionIssueMatcher.issue(expectedIssue));
    Property.builder().code("").build();
}
Also used : Issue(com.b2international.snowowl.fhir.core.model.Issue) Builder(com.b2international.snowowl.fhir.core.model.Issue.Builder) FhirTest(com.b2international.snowowl.fhir.tests.FhirTest) Test(org.junit.Test)

Example 8 with Issue

use of com.b2international.snowowl.fhir.core.model.Issue in project snow-owl by b2ihealthcare.

the class PropertySerializationTest method missingCodeTest.

@Test
public void missingCodeTest() throws Exception {
    Builder builder = Issue.builder().code(IssueType.INVALID).severity(IssueSeverity.ERROR).diagnostics("1 validation error");
    Issue expectedIssue = builder.addLocation("Property.code").detailsWithDisplay(OperationOutcomeCode.MSG_PARAM_INVALID, "Parameter 'code' content is invalid [null]. Violation: may not be null.").build();
    exception.expect(ValidationException.class);
    exception.expectMessage("1 validation error");
    exception.expect(FhirExceptionIssueMatcher.issue(expectedIssue));
    Property.builder().build();
}
Also used : Issue(com.b2international.snowowl.fhir.core.model.Issue) Builder(com.b2international.snowowl.fhir.core.model.Issue.Builder) FhirTest(com.b2international.snowowl.fhir.tests.FhirTest) Test(org.junit.Test)

Example 9 with Issue

use of com.b2international.snowowl.fhir.core.model.Issue in project snow-owl by b2ihealthcare.

the class ValidateCodeSystemCodeRequestTest method differentSystemsTest.

@Test
public void differentSystemsTest() {
    Builder builder = Issue.builder().code(IssueType.INVALID).severity(IssueSeverity.ERROR).diagnostics("1 validation error");
    Issue expectedIssue = builder.addLocation("ValidateCodeRequest.systemsDifferent").detailsWithDisplay(OperationOutcomeCode.MSG_PARAM_INVALID, "Parameter 'systemsDifferent' content is invalid [false]." + " Violation: System URL and Coding.system are different.").build();
    exception.expect(ValidationException.class);
    exception.expectMessage("1 validation error");
    exception.expect(FhirExceptionIssueMatcher.issue(expectedIssue));
    ValidateCodeRequest.builder().url("systemURI").coding(Coding.builder().code("A").system("systemURI2").build()).build();
}
Also used : Issue(com.b2international.snowowl.fhir.core.model.Issue) Builder(com.b2international.snowowl.fhir.core.model.Issue.Builder) FhirTest(com.b2international.snowowl.fhir.tests.FhirTest) Test(org.junit.Test)

Example 10 with Issue

use of com.b2international.snowowl.fhir.core.model.Issue in project snow-owl by b2ihealthcare.

the class ValidateCodeSystemCodeRequestTest method differentSystemsInCodeableTest.

@Test
public void differentSystemsInCodeableTest() {
    Builder builder = Issue.builder().code(IssueType.INVALID).severity(IssueSeverity.ERROR).diagnostics("1 validation error");
    Issue expectedIssue = builder.addLocation("ValidateCodeRequest.invalidCodeableSystem").detailsWithDisplay(OperationOutcomeCode.MSG_PARAM_INVALID, "Parameter 'invalidCodeableSystem' content is invalid [false]." + " Violation: System URL and a Coding.system in Codeable are different.").build();
    exception.expect(ValidationException.class);
    exception.expectMessage("1 validation error");
    exception.expect(FhirExceptionIssueMatcher.issue(expectedIssue));
    ValidateCodeRequest.builder().url("systemURI").codeableConcept(CodeableConcept.builder().addCoding(Coding.builder().code("A").system("systemURI2").build()).build()).build();
}
Also used : Issue(com.b2international.snowowl.fhir.core.model.Issue) Builder(com.b2international.snowowl.fhir.core.model.Issue.Builder) FhirTest(com.b2international.snowowl.fhir.tests.FhirTest) Test(org.junit.Test)

Aggregations

Issue (com.b2international.snowowl.fhir.core.model.Issue)47 Test (org.junit.Test)44 FhirTest (com.b2international.snowowl.fhir.tests.FhirTest)42 Builder (com.b2international.snowowl.fhir.core.model.Issue.Builder)18 Coding (com.b2international.snowowl.fhir.core.model.dt.Coding)6 ValidationException (com.b2international.snowowl.fhir.core.exceptions.ValidationException)5 OperationOutcomeCode (com.b2international.snowowl.fhir.core.codesystems.OperationOutcomeCode)4 OperationOutcome (com.b2international.snowowl.fhir.core.model.OperationOutcome)4 CodeableConcept (com.b2international.snowowl.fhir.core.model.dt.CodeableConcept)4 Fhir (com.b2international.snowowl.fhir.core.model.dt.Parameters.Fhir)4 Json (com.b2international.snowowl.fhir.core.model.dt.Parameters.Json)4 IssueSeverity (com.b2international.snowowl.fhir.core.codesystems.IssueSeverity)3 IssueType (com.b2international.snowowl.fhir.core.codesystems.IssueType)3 Parameters (com.b2international.snowowl.fhir.core.model.dt.Parameters)3 FhirExceptionIssueMatcher (com.b2international.snowowl.fhir.tests.FhirExceptionIssueMatcher)3 Optional (java.util.Optional)3 Assert.assertTrue (org.junit.Assert.assertTrue)3 BadRequestException (com.b2international.snowowl.fhir.core.exceptions.BadRequestException)2 LookupRequest (com.b2international.snowowl.fhir.core.model.codesystem.LookupRequest)2 Parameter (com.b2international.snowowl.fhir.core.model.dt.Parameter)2