Search in sources :

Example 6 with Builder

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

the class ValidateCodeSystemCodeRequestTest method missingCodeTest.

@Test
public void missingCodeTest() {
    Builder builder = Issue.builder().code(IssueType.INVALID).severity(IssueSeverity.ERROR).diagnostics("1 validation error");
    Issue expectedIssue = builder.addLocation("ValidateCodeRequest.codeMissing").detailsWithDisplay(OperationOutcomeCode.MSG_PARAM_INVALID, "Parameter 'codeMissing' content is invalid [false]." + " Violation: No code is provided to validate.").build();
    exception.expect(ValidationException.class);
    exception.expectMessage("1 validation error");
    exception.expect(FhirExceptionIssueMatcher.issue(expectedIssue));
    ValidateCodeRequest.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 7 with Builder

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

the class ValidateCodeSystemCodeRequestTest method missingCodeWithDisplayTest.

@Test
public void missingCodeWithDisplayTest() {
    Builder builder = Issue.builder().code(IssueType.INVALID).severity(IssueSeverity.ERROR).diagnostics("1 validation error");
    Issue expectedIssue = builder.addLocation("ValidateCodeRequest.codeProvidedWithDisplay").detailsWithDisplay(OperationOutcomeCode.MSG_PARAM_INVALID, "Parameter 'codeProvidedWithDisplay' content is invalid [false]." + " Violation: Code is missing while display is provided.").build();
    exception.expect(ValidationException.class);
    exception.expectMessage("1 validation error");
    exception.expect(FhirExceptionIssueMatcher.issue(expectedIssue));
    ValidateCodeRequest.builder().display("TermA").url("systemURI").coding(Coding.builder().code("A").system("systemURI").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 8 with Builder

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

the class ExpandValueSetRequestDeserializationTest method missingCodeTest.

// @Test
public void missingCodeTest() {
    Builder builder = Issue.builder().code(IssueType.INVALID).severity(IssueSeverity.ERROR).diagnostics("1 validation error");
    Issue expectedIssue = builder.addLocation("LookupRequest.codeMissing").detailsWithDisplay(OperationOutcomeCode.MSG_PARAM_INVALID, "Parameter 'codeMissing' content is invalid [false]." + " Violation: Code is not provided for the system.").build();
    exception.expect(ValidationException.class);
    exception.expectMessage("1 validation error");
    exception.expect(FhirExceptionIssueMatcher.issue(expectedIssue));
    System.out.println("Building the lookup request object.");
    LookupRequest.builder().system("system").build();
}
Also used : Issue(com.b2international.snowowl.fhir.core.model.Issue) Builder(com.b2international.snowowl.fhir.core.model.Issue.Builder)

Example 9 with Builder

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

the class DesignationSerializationTest method emptyValueTest.

@Test
public void emptyValueTest() throws Exception {
    Builder builder = Issue.builder().code(IssueType.INVALID).severity(IssueSeverity.ERROR).diagnostics("1 validation error");
    Issue expectedIssue = builder.addLocation("Designation.value").detailsWithDisplay(OperationOutcomeCode.MSG_PARAM_INVALID, "Parameter 'value' content is invalid []. Violation: may not be empty.").build();
    exception.expect(ValidationException.class);
    exception.expectMessage("1 validation error");
    exception.expect(FhirExceptionIssueMatcher.issue(expectedIssue));
    Designation.builder().value("").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 Builder

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

the class LookupResultSerializationTest method emptyNameTest.

@Test
public void emptyNameTest() throws Exception {
    Builder builder = Issue.builder().code(IssueType.INVALID).severity(IssueSeverity.ERROR).diagnostics("1 validation error");
    Issue expectedIssue = builder.addLocation("LookupResult.name").detailsWithDisplay(OperationOutcomeCode.MSG_PARAM_INVALID, "Parameter 'name' content is invalid []. Violation: may not be empty.").build();
    exception.expect(ValidationException.class);
    exception.expectMessage("1 validation error");
    exception.expect(FhirExceptionIssueMatcher.issue(expectedIssue));
    LookupResult.builder().display("display").name("").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)15 Builder (com.b2international.snowowl.fhir.core.model.Issue.Builder)15 FhirTest (com.b2international.snowowl.fhir.tests.FhirTest)14 Test (org.junit.Test)14