Search in sources :

Example 21 with JsonPath

use of io.restassured.path.json.JsonPath in project snow-owl by b2ihealthcare.

the class CodeableConceptUsageContextTest method serialize.

@Test
public void serialize() throws Exception {
    printPrettyJson(usageContext);
    JsonPath jsonPath = JsonPath.from(objectMapper.writeValueAsString(usageContext));
    assertThat(jsonPath.getString("id"), equalTo("usageContextId"));
    assertThat(jsonPath.getString("code.code"), equalTo("coding"));
    assertThat(jsonPath.getString("code.display"), equalTo("codingDisplay"));
    assertThat(jsonPath.getString("valueCodeableConcept.text"), equalTo("text"));
    assertThat(jsonPath.getString("valueCodeableConcept.coding[0].code"), equalTo("1234"));
    assertThat(jsonPath.getString("valueCodeableConcept.coding[0].system"), equalTo("http://www.whocc.no/atc"));
    assertThat(jsonPath.getString("valueCodeableConcept.coding[0].version"), equalTo("20180131"));
}
Also used : JsonPath(io.restassured.path.json.JsonPath) FhirTest(com.b2international.snowowl.fhir.tests.FhirTest) Test(org.junit.Test)

Example 22 with JsonPath

use of io.restassured.path.json.JsonPath in project snow-owl by b2ihealthcare.

the class DocumentTest method serialize.

@Test
public void serialize() throws Exception {
    JsonPath jsonPath = JsonPath.from(objectMapper.writeValueAsString(document));
    assertThat(jsonPath.getString("documentation"), equalTo("documentation"));
    assertThat(jsonPath.getString("mode"), equalTo("consumer"));
    assertThat(jsonPath.getString("profile"), equalTo("profile"));
}
Also used : JsonPath(io.restassured.path.json.JsonPath) FhirTest(com.b2international.snowowl.fhir.tests.FhirTest) Test(org.junit.Test)

Example 23 with JsonPath

use of io.restassured.path.json.JsonPath in project snow-owl by b2ihealthcare.

the class SearchParamTest method serialize.

@Test
public void serialize() throws Exception {
    printPrettyJson(searchParam);
    JsonPath jsonPath = JsonPath.from(objectMapper.writeValueAsString(searchParam));
    assertThat(jsonPath.getString("definition"), equalTo("definition"));
    assertThat(jsonPath.getString("documentation"), equalTo("documentation"));
    assertThat(jsonPath.getString("name"), equalTo("name"));
    assertThat(jsonPath.getString("type"), equalTo("string"));
}
Also used : JsonPath(io.restassured.path.json.JsonPath) FhirTest(com.b2international.snowowl.fhir.tests.FhirTest) Test(org.junit.Test)

Example 24 with JsonPath

use of io.restassured.path.json.JsonPath in project snow-owl by b2ihealthcare.

the class PropertySerializationTest method basicPropertyTest.

@Test
public void basicPropertyTest() throws Exception {
    Property property = Property.builder().code("123").valueInteger(2).description("propertyDescription").build();
    Fhir fhirParameters = new Parameters.Fhir(property);
    JsonPath jsonPath = JsonPath.from(objectMapper.writeValueAsString(fhirParameters));
    assertThat(jsonPath.getString("resourceType"), equalTo("Parameters"));
    assertThat(jsonPath.getList("parameter").size(), is(3));
    assertThat(jsonPath, FhirParameterMatcher.hasParameter("code", FhirDataType.CODE, "123"));
    assertThat(jsonPath, FhirParameterMatcher.hasParameter("value", FhirDataType.INTEGER, 2));
    assertThat(jsonPath, FhirParameterMatcher.hasParameter("description", FhirDataType.STRING, "propertyDescription"));
}
Also used : Fhir(com.b2international.snowowl.fhir.core.model.dt.Parameters.Fhir) JsonPath(io.restassured.path.json.JsonPath) Property(com.b2international.snowowl.fhir.core.model.codesystem.Property) SubProperty(com.b2international.snowowl.fhir.core.model.dt.SubProperty) FhirTest(com.b2international.snowowl.fhir.tests.FhirTest) Test(org.junit.Test)

Example 25 with JsonPath

use of io.restassured.path.json.JsonPath in project snow-owl by b2ihealthcare.

the class PropertySerializationTest method minimalPropertyTest.

@Test
public void minimalPropertyTest() throws Exception {
    Property property = Property.builder().code("123").build();
    Fhir fhirParameters = new Parameters.Fhir(property);
    JsonPath jsonPath = JsonPath.from(objectMapper.writeValueAsString(fhirParameters));
    assertThat(jsonPath.getString("resourceType"), equalTo("Parameters"));
    assertThat(jsonPath.getList("parameter").size(), is(1));
    assertThat(jsonPath, FhirParameterMatcher.hasParameter("code", FhirDataType.CODE, "123"));
}
Also used : Fhir(com.b2international.snowowl.fhir.core.model.dt.Parameters.Fhir) JsonPath(io.restassured.path.json.JsonPath) Property(com.b2international.snowowl.fhir.core.model.codesystem.Property) SubProperty(com.b2international.snowowl.fhir.core.model.dt.SubProperty) FhirTest(com.b2international.snowowl.fhir.tests.FhirTest) Test(org.junit.Test)

Aggregations

JsonPath (io.restassured.path.json.JsonPath)117 Test (org.junit.Test)101 FhirTest (com.b2international.snowowl.fhir.tests.FhirTest)82 Response (io.restassured.response.Response)9 Fhir (com.b2international.snowowl.fhir.core.model.dt.Parameters.Fhir)8 Date (java.util.Date)6 Property (com.b2international.snowowl.fhir.core.model.codesystem.Property)4 Coding (com.b2international.snowowl.fhir.core.model.dt.Coding)4 SubProperty (com.b2international.snowowl.fhir.core.model.dt.SubProperty)4 CodeSystem (com.b2international.snowowl.fhir.core.model.codesystem.CodeSystem)3 Uri (com.b2international.snowowl.fhir.core.model.dt.Uri)3 HashMap (java.util.HashMap)3 TranslateResult (com.b2international.snowowl.fhir.core.model.conceptmap.TranslateResult)2 BigDecimal (java.math.BigDecimal)2 SimpleDateFormat (java.text.SimpleDateFormat)2 ArrayList (java.util.ArrayList)2 AbstractIntegrationTest (org.codice.ddf.itests.common.AbstractIntegrationTest)2 MappingJackson2HttpMessageConverter (org.springframework.http.converter.json.MappingJackson2HttpMessageConverter)2 MockMvc (org.springframework.test.web.servlet.MockMvc)2 OperationOutcomeCode (com.b2international.snowowl.fhir.core.codesystems.OperationOutcomeCode)1