Search in sources :

Example 11 with Builder

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

the class LookupResultSerializationTest method missingDisplayTest.

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

Example 12 with Builder

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

the class LookupResultSerializationTest method missingNameTest.

@Test
public void missingNameTest() 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 [null]. Violation: may not be empty.").build();
    exception.expect(ValidationException.class);
    exception.expectMessage("1 validation error");
    exception.expect(FhirExceptionIssueMatcher.issue(expectedIssue));
    LookupResult.builder().display("display").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 13 with Builder

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

the class LookupRequestDeserializationTest 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));
    LookupRequest.builder().system("system").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 14 with Builder

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

the class DesignationSerializationTest method missingValueTest.

@Test
public void missingValueTest() 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 [null]. Violation: may not be empty.").build();
    exception.expect(ValidationException.class);
    exception.expectMessage("1 validation error");
    exception.expect(FhirExceptionIssueMatcher.issue(expectedIssue));
    Designation.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 15 with Builder

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

the class ValidateCodeSystemCodeRequestTest method multipleCodesTest.

@Test
public void multipleCodesTest() {
    Builder builder = Issue.builder().code(IssueType.INVALID).severity(IssueSeverity.ERROR).diagnostics("1 validation error");
    Issue expectedIssue = builder.addLocation("ValidateCodeRequest.tooManyCodesDefined").detailsWithDisplay(OperationOutcomeCode.MSG_PARAM_INVALID, "Parameter 'tooManyCodesDefined' content is invalid [false]." + " Violation: Either code, coding or codeable can be defined at a time.").build();
    exception.expect(ValidationException.class);
    exception.expectMessage("1 validation error");
    exception.expect(FhirExceptionIssueMatcher.issue(expectedIssue));
    ValidateCodeRequest.builder().code("B").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)

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