Search in sources :

Example 41 with Issue

use of com.b2international.snowowl.fhir.core.model.Issue 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 42 with Issue

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

the class TranslateRequestDeserializationTest method missingSystemTest.

@Test
public void missingSystemTest() {
    Issue expectedIssue = Issue.builder().code(IssueType.INVALID).severity(IssueSeverity.ERROR).diagnostics("1 validation error").addLocation("TranslateRequest.codeAndSystemValid").detailsWithDisplay(OperationOutcomeCode.MSG_PARAM_INVALID, "Parameter 'codeAndSystemValid' content is invalid [false]." + " Violation: Both code and system needs to be provided.").build();
    exception.expect(ValidationException.class);
    exception.expectMessage("1 validation error");
    exception.expect(FhirExceptionIssueMatcher.issue(expectedIssue));
    TranslateRequest.builder().code("fatal").target("target").build();
}
Also used : Issue(com.b2international.snowowl.fhir.core.model.Issue) FhirTest(com.b2international.snowowl.fhir.tests.FhirTest) Test(org.junit.Test)

Example 43 with Issue

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

the class TranslateRequestDeserializationTest method invalidSnomedVersionTest.

// If the system is SNOMED, no version information is accepted as it is part of the URI
// @see SnomedUri
@Test
public void invalidSnomedVersionTest() {
    Issue expectedIssue = Issue.builder().code(IssueType.INVALID).severity(IssueSeverity.ERROR).diagnostics("1 validation error").addLocation("TranslateRequest.versionValid").detailsWithDisplay(OperationOutcomeCode.MSG_PARAM_INVALID, "Parameter 'versionValid' content is invalid [false]. " + "Violation: SNOMED CT version is defined as part of the system URI.").build();
    exception.expect(ValidationException.class);
    exception.expectMessage("1 validation error");
    exception.expect(FhirExceptionIssueMatcher.issue(expectedIssue));
    TranslateRequest.builder().code("1234").system(SnomedUri.SNOMED_BASE_URI_STRING + "/20180131").version("OTHER_VERSION").targetSystem(SnomedUri.SNOMED_BASE_URI).build();
}
Also used : Issue(com.b2international.snowowl.fhir.core.model.Issue) FhirTest(com.b2international.snowowl.fhir.tests.FhirTest) Test(org.junit.Test)

Example 44 with Issue

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

the class TranslateRequestDeserializationTest method missingSourceTest.

@Test
public void missingSourceTest() {
    Issue expectedIssue = Issue.builder().code(IssueType.INVALID).severity(IssueSeverity.ERROR).diagnostics("1 validation error").addLocation("TranslateRequest.sourceValid").detailsWithDisplay(OperationOutcomeCode.MSG_PARAM_INVALID, "Parameter 'sourceValid' content is invalid [false]. " + "Violation: Source needs to be set either via code/system or code or codeable concept.").build();
    exception.expect(ValidationException.class);
    exception.expectMessage("1 validation error");
    exception.expect(FhirExceptionIssueMatcher.issue(expectedIssue));
    TranslateRequest.builder().target("target").build();
}
Also used : Issue(com.b2international.snowowl.fhir.core.model.Issue) FhirTest(com.b2international.snowowl.fhir.tests.FhirTest) Test(org.junit.Test)

Example 45 with Issue

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

the class TranslateRequestDeserializationTest method invalidSnomedCodingTest.

// If the system is SNOMED, no version information is accepted as it is part of the URI
// @see SnomedUri
@Test
public void invalidSnomedCodingTest() {
    Issue expectedIssue = Issue.builder().code(IssueType.INVALID).severity(IssueSeverity.ERROR).diagnostics("1 validation error").addLocation("Coding.versionValid").detailsWithDisplay(OperationOutcomeCode.MSG_PARAM_INVALID, "Parameter 'versionValid' content is invalid [false]. " + "Violation: SNOMED CT version is defined as part of the system URI.").build();
    exception.expect(ValidationException.class);
    exception.expectMessage("1 validation error");
    exception.expect(FhirExceptionIssueMatcher.issue(expectedIssue));
    TranslateRequest.builder().coding(Coding.builder().system(SnomedUri.SNOMED_BASE_URI_STRING).version("OTHER_VERSION").code("fatal").build()).version("OTHER_VERSION").targetSystem(SnomedUri.SNOMED_BASE_URI).build();
}
Also used : Issue(com.b2international.snowowl.fhir.core.model.Issue) 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