Search in sources :

Example 26 with JsonPath

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

the class MetaTest method serialize.

@Test
public void serialize() throws Exception {
    JsonPath jsonPath = JsonPath.from(objectMapper.writeValueAsString(meta));
    assertThat(jsonPath.getString("versionId"), equalTo("VersionID"));
    assertThat(jsonPath.getString("lastUpdated"), equalTo("2018-03-23T07:49:40Z"));
    assertThat(jsonPath.getString("security[0].code"), equalTo("A"));
    assertThat(jsonPath.getString("tag[0].code"), equalTo("TagA"));
    assertThat(jsonPath.getString("profile[0]"), equalTo("profile"));
}
Also used : JsonPath(io.restassured.path.json.JsonPath) FhirTest(com.b2international.snowowl.fhir.tests.FhirTest) Test(org.junit.Test)

Example 27 with JsonPath

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

the class ReferenceTest method serialize.

@Test
public void serialize() throws Exception {
    String expected = "{\"reference\":\"reference url\"," + "\"identifier\":{\"system\":\"system\"}," + "\"display\":\"displayString\"}";
    JsonPath jsonPath = JsonPath.from(objectMapper.writeValueAsString(reference));
    assertThat(jsonPath.getString("reference"), equalTo("reference url"));
    assertThat(jsonPath.getString("identifier.system"), equalTo("system"));
    assertThat(jsonPath.getString("display"), equalTo("displayString"));
    assertEquals(expected, objectMapper.writeValueAsString(reference));
}
Also used : JsonPath(io.restassured.path.json.JsonPath) FhirTest(com.b2international.snowowl.fhir.tests.FhirTest) Test(org.junit.Test)

Example 28 with JsonPath

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

the class SimpleQuantityTest method serialize.

@Test
public void serialize() throws Exception {
    JsonPath jsonPath = JsonPath.from(objectMapper.writeValueAsString(quantity));
    assertThat(jsonPath.getDouble("value"), equalTo(12.3));
    assertThat(jsonPath.getString("unit"), equalTo("mg"));
    assertThat(jsonPath.getString("system"), equalTo("uri:LOINC"));
    assertThat(jsonPath.getString("code"), equalTo("code"));
}
Also used : JsonPath(io.restassured.path.json.JsonPath) FhirTest(com.b2international.snowowl.fhir.tests.FhirTest) Test(org.junit.Test)

Example 29 with JsonPath

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

the class ContactPointTest method serialize.

@Test
public void serialize() throws Exception {
    JsonPath jsonPath = JsonPath.from(objectMapper.writeValueAsString(contactPoint));
    assertThat(jsonPath.getString("id"), equalTo("element_id"));
    assertThat(jsonPath.getString("system"), equalTo("system"));
    assertThat(jsonPath.getString("value"), equalTo("value"));
    assertThat(jsonPath.getInt("rank"), equalTo(1));
    assertThat(jsonPath.get("period.start"), equalTo(null));
    assertThat(jsonPath.get("period.end"), equalTo(null));
    assertThat(jsonPath.getString("extension[0].url"), equalTo("url"));
    assertThat(jsonPath.getInt("extension[0].valueInteger"), equalTo(1));
    assertThat(jsonPath.getString("extension[1].url"), equalTo("url2"));
    assertThat(jsonPath.getInt("extension[1].valueInteger"), equalTo(2));
}
Also used : JsonPath(io.restassured.path.json.JsonPath) FhirTest(com.b2international.snowowl.fhir.tests.FhirTest) Test(org.junit.Test)

Example 30 with JsonPath

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

the class RangeTest method serialize.

@Test
public void serialize() throws Exception {
    JsonPath jsonPath = JsonPath.from(objectMapper.writeValueAsString(range));
    assertThat(jsonPath.getDouble("low.value"), equalTo(12.3));
    assertThat(jsonPath.getString("low.unit"), equalTo("mg"));
    assertThat(jsonPath.getString("low.system"), equalTo("uri:LOINC"));
    assertThat(jsonPath.getString("low.code"), equalTo("code1"));
    assertThat(jsonPath.getDouble("high.value"), equalTo(120.3));
    assertThat(jsonPath.getString("high.unit"), equalTo("mg"));
    assertThat(jsonPath.getString("high.system"), equalTo("uri:LOINC"));
    assertThat(jsonPath.getString("high.code"), equalTo("code2"));
}
Also used : JsonPath(io.restassured.path.json.JsonPath) 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