Search in sources :

Example 6 with ValidateCodeResult

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

the class ValidateFhirCodeRestTest method invalidCodeWithUrlGetTest.

/*
	 * Non-instance calls (no ID in the path)
	 */
@Test
public void invalidCodeWithUrlGetTest() throws Exception {
    String responseString = givenAuthenticatedRequest(FHIR_ROOT_CONTEXT).param("code", "unknownCode").param("url", FHIR_ISSUE_TYPE_CODESYSTEM_URI).param("_format", "json").when().get("/CodeSystem/$validate-code").then().assertThat().statusCode(200).extract().body().asString();
    ValidateCodeResult result = convertToValidateCodeResult(responseString);
    assertEquals(false, result.getResult());
    assertEquals("Could not find code(s) '[unknownCode]'", result.getMessage());
    assertNull(result.getDisplay());
}
Also used : ValidateCodeResult(com.b2international.snowowl.fhir.core.model.ValidateCodeResult) Test(org.junit.Test) FhirRestTest(com.b2international.snowowl.fhir.tests.FhirRestTest)

Example 7 with ValidateCodeResult

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

the class ValidateFhirCodeRestTest method validCodeWithInvalidDisplayGetTest.

@Test
public void validCodeWithInvalidDisplayGetTest() throws Exception {
    String responseString = givenAuthenticatedRequest(FHIR_ROOT_CONTEXT).pathParam("id", FHIR_ISSUE_TYPE_CODESYSTEM_ID).param("code", "login").param("display", "invalid").param("_format", "json").when().get("/CodeSystem/{id}/$validate-code").then().assertThat().statusCode(200).extract().body().asString();
    ValidateCodeResult result = convertToValidateCodeResult(responseString);
    assertEquals(false, result.getResult());
    assertEquals("Incorrect display 'invalid' for code 'login'", result.getMessage());
    assertEquals("Login Required", result.getDisplay());
}
Also used : ValidateCodeResult(com.b2international.snowowl.fhir.core.model.ValidateCodeResult) Test(org.junit.Test) FhirRestTest(com.b2international.snowowl.fhir.tests.FhirRestTest)

Aggregations

ValidateCodeResult (com.b2international.snowowl.fhir.core.model.ValidateCodeResult)7 Test (org.junit.Test)6 FhirRestTest (com.b2international.snowowl.fhir.tests.FhirRestTest)4 FhirTest (com.b2international.snowowl.fhir.tests.FhirTest)2 ServiceProvider (com.b2international.snowowl.core.ServiceProvider)1 CodeSystemRequests (com.b2international.snowowl.core.codesystem.CodeSystemRequests)1 Concept (com.b2international.snowowl.core.domain.Concept)1 CodeSystem (com.b2international.snowowl.fhir.core.model.codesystem.CodeSystem)1 ValidateCodeRequest (com.b2international.snowowl.fhir.core.model.codesystem.ValidateCodeRequest)1 CodeableConcept (com.b2international.snowowl.fhir.core.model.dt.CodeableConcept)1 Coding (com.b2international.snowowl.fhir.core.model.dt.Coding)1 Parameters (com.b2international.snowowl.fhir.core.model.dt.Parameters)1 Fhir (com.b2international.snowowl.fhir.core.model.dt.Parameters.Fhir)1 Json (com.b2international.snowowl.fhir.core.model.dt.Parameters.Json)1 JsonProperty (com.fasterxml.jackson.annotation.JsonProperty)1 JsonUnwrapped (com.fasterxml.jackson.annotation.JsonUnwrapped)1 ImmutableSortedSet (com.google.common.collect.ImmutableSortedSet)1 Sets (com.google.common.collect.Sets)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1