Search in sources :

Example 11 with CodeableConcept

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

the class CodeableConcepTest method serialize.

@Test
public void serialize() throws Exception {
    Coding coding = Coding.builder().code("1234").system("http://www.whocc.no/atc").version("20180131").build();
    CodeableConcept cc = CodeableConcept.builder().addCoding(coding).text("text").build();
    JsonPath jsonPath = JsonPath.from(objectMapper.writeValueAsString(cc));
    assertThat(jsonPath.getString("text"), equalTo("text"));
    assertThat(jsonPath.getString("coding[0].code"), equalTo("1234"));
    assertThat(jsonPath.getString("coding[0].system"), equalTo("http://www.whocc.no/atc"));
    assertThat(jsonPath.getString("coding[0].version"), equalTo("20180131"));
}
Also used : Coding(com.b2international.snowowl.fhir.core.model.dt.Coding) JsonPath(io.restassured.path.json.JsonPath) CodeableConcept(com.b2international.snowowl.fhir.core.model.dt.CodeableConcept) FhirTest(com.b2international.snowowl.fhir.tests.FhirTest) Test(org.junit.Test)

Aggregations

CodeableConcept (com.b2international.snowowl.fhir.core.model.dt.CodeableConcept)11 Coding (com.b2international.snowowl.fhir.core.model.dt.Coding)10 Test (org.junit.Test)6 FhirTest (com.b2international.snowowl.fhir.tests.FhirTest)5 Issue (com.b2international.snowowl.fhir.core.model.Issue)4 OperationOutcome (com.b2international.snowowl.fhir.core.model.OperationOutcome)1 Builder (com.b2international.snowowl.fhir.core.model.OperationOutcome.Builder)1 ValidateCodeRequest (com.b2international.snowowl.fhir.core.model.codesystem.ValidateCodeRequest)1 Fhir (com.b2international.snowowl.fhir.core.model.dt.Parameters.Fhir)1 FhirRestTest (com.b2international.snowowl.fhir.tests.FhirRestTest)1 JsonPath (io.restassured.path.json.JsonPath)1 HashSet (java.util.HashSet)1 Before (org.junit.Before)1