Search in sources :

Example 81 with JsonPath

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

the class QuantityTest 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("comparator"), equalTo(">="));
    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 82 with JsonPath

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

the class EndpointTest method serialize.

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

Example 83 with JsonPath

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

the class OperationTest method serialize.

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

Example 84 with JsonPath

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

the class LookupResultSerializationTest method lookupResultTest.

@Test
public void lookupResultTest() throws Exception {
    LookupResult lookupResult = LookupResult.builder().name("test").display("display").designation(List.of(Designation.builder().value("dValue").languageCode("uk").build())).property(List.of(Property.builder().code("1234").description("propDescription").valueString("sds").addSubProperty(SubProperty.builder().code("subCode").description("subDescription").valueInteger(1).build()).build())).build();
    Fhir fhirParameters = new Parameters.Fhir(lookupResult);
    JsonPath jsonPath = JsonPath.from(objectMapper.writeValueAsString(fhirParameters));
    assertThat(jsonPath.getString("resourceType"), equalTo("Parameters"));
    assertThat(jsonPath.getList("parameter.name"), hasItems("name", "display", "designation", "property"));
    assertThat(jsonPath, FhirParameterMatcher.hasParameter("name", FhirDataType.STRING, "test"));
    assertThat(jsonPath, FhirParameterMatcher.hasParameter("display", FhirDataType.STRING, "display"));
    assertThat(jsonPath.getString("parameter[2].name"), equalTo("designation"));
    assertThat(jsonPath.getString("parameter[2].part[0].name"), equalTo("language"));
    assertThat(jsonPath.getString("parameter[2].part[0].valueCode"), equalTo("uk"));
    assertThat(jsonPath.getString("parameter[2].part[1].name"), equalTo("value"));
    assertThat(jsonPath.getString("parameter[2].part[1].valueString"), equalTo("dValue"));
    assertThat(jsonPath.getString("parameter[3].name"), equalTo("property"));
    assertThat(jsonPath.getString("parameter[3].part[0].name"), equalTo("code"));
    assertThat(jsonPath.getString("parameter[3].part[0].valueCode"), equalTo("1234"));
    assertThat(jsonPath.getString("parameter[3].part[1].name"), equalTo("value"));
    assertThat(jsonPath.getString("parameter[3].part[1].valueString"), equalTo("sds"));
    assertThat(jsonPath.getString("parameter[3].part[2].name"), equalTo("description"));
    assertThat(jsonPath.getString("parameter[3].part[2].valueString"), equalTo("propDescription"));
    assertThat(jsonPath.getString("parameter[3].part[3].name"), equalTo("subproperty"));
    assertThat(jsonPath.getString("parameter[3].part[3].part[0].name"), equalTo("code"));
    assertThat(jsonPath.getString("parameter[3].part[3].part[0].valueCode"), equalTo("subCode"));
    assertThat(jsonPath.getString("parameter[3].part[3].part[1].name"), equalTo("value"));
    assertThat(jsonPath.getInt("parameter[3].part[3].part[1].valueInteger"), equalTo(1));
    assertThat(jsonPath.getString("parameter[3].part[3].part[2].name"), equalTo("description"));
    assertThat(jsonPath.getString("parameter[3].part[3].part[2].valueString"), equalTo("subDescription"));
}
Also used : LookupResult(com.b2international.snowowl.fhir.core.model.codesystem.LookupResult) Fhir(com.b2international.snowowl.fhir.core.model.dt.Parameters.Fhir) JsonPath(io.restassured.path.json.JsonPath) FhirTest(com.b2international.snowowl.fhir.tests.FhirTest) Test(org.junit.Test)

Example 85 with JsonPath

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

the class ValueSetConceptTest method serialize.

@Test
public void serialize() throws Exception {
    JsonPath jsonPath = JsonPath.from(objectMapper.writeValueAsString(concept));
    assertThat(jsonPath.getString("code"), equalTo("code"));
    assertThat(jsonPath.getString("display"), equalTo("display"));
    assertThat(jsonPath.getString("designation[0].language"), equalTo("gb_en"));
    assertThat(jsonPath.getString("designation[0].use.code"), equalTo("internal"));
    assertThat(jsonPath.getString("designation[0].use.system"), equalTo("http://b2i.sg/test"));
    assertThat(jsonPath.getString("designation[0].value"), equalTo("designationValue"));
    assertThat(jsonPath.getString("designation[0].languageCode"), equalTo("gb_en"));
}
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