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());
}
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());
}
Aggregations