Search in sources :

Example 96 with JsonPath

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

the class ExpansionParameterTest method serializeDateTimeParameter.

@Test
public void serializeDateTimeParameter() throws Exception {
    Date date = new SimpleDateFormat(FhirDates.DATE_TIME_FORMAT).parse(TEST_DATE_STRING);
    DateTimeParameter parameter = DateTimeParameter.builder().name("paramName").value(date).build();
    JsonPath jsonPath = getJsonPath(parameter);
    assertThat(jsonPath.getString("name"), equalTo("paramName"));
    assertThat(jsonPath.get("valueDateTime"), equalTo(TEST_DATE_STRING));
}
Also used : JsonPath(io.restassured.path.json.JsonPath) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date) FhirTest(com.b2international.snowowl.fhir.tests.FhirTest) Test(org.junit.Test)

Example 97 with JsonPath

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

the class IncludeTest method serialize.

@Test
public void serialize() throws Exception {
    JsonPath jsonPath = JsonPath.from(objectMapper.writeValueAsString(include));
    assertThat(jsonPath.getString("system"), equalTo("system"));
    assertThat(jsonPath.getString("version"), equalTo("version"));
    assertThat(jsonPath.getString("valueSet[0]"), equalTo("valueSetUri"));
    assertThat(jsonPath.getString("concept[0].code"), equalTo("code"));
    assertThat(jsonPath.getString("concept[0].display"), equalTo("display"));
    assertThat(jsonPath.getString("concept[0].designation[0].language"), equalTo("gb_en"));
    assertThat(jsonPath.getString("concept[0].designation[0].use.code"), equalTo("internal"));
    assertThat(jsonPath.getString("concept[0].designation[0].use.system"), equalTo("http://b2i.sg/test"));
    assertThat(jsonPath.getString("concept[0].designation[0].value"), equalTo("designationValue"));
    assertThat(jsonPath.getString("concept[0].designation[0].languageCode"), equalTo("gb_en"));
    assertThat(jsonPath.getString("filter[0].property"), equalTo("filterProperty"));
    assertThat(jsonPath.getString("filter[0].value"), equalTo("1234567"));
    assertThat(jsonPath.getString("filter[0].op"), equalTo("="));
}
Also used : JsonPath(io.restassured.path.json.JsonPath) FhirTest(com.b2international.snowowl.fhir.tests.FhirTest) Test(org.junit.Test)

Example 98 with JsonPath

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

the class ValueSetFilterTest method serialize.

@Test
public void serialize() throws Exception {
    JsonPath jsonPath = JsonPath.from(objectMapper.writeValueAsString(filter));
    assertThat(jsonPath.getString("op"), equalTo("="));
    assertThat(jsonPath.getString("value"), equalTo("1234567"));
    assertThat(jsonPath.getString("property"), equalTo("filterProperty"));
}
Also used : JsonPath(io.restassured.path.json.JsonPath) FhirTest(com.b2international.snowowl.fhir.tests.FhirTest) Test(org.junit.Test)

Example 99 with JsonPath

use of io.restassured.path.json.JsonPath 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)

Example 100 with JsonPath

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

the class ContactDetailTest method serialize.

@Test
public void serialize() throws Exception {
    JsonPath jsonPath = JsonPath.from(objectMapper.writeValueAsString(contactDetail));
    assertThat(jsonPath.getString("name"), equalTo("name"));
    jsonPath.setRoot("telecom[0]");
    assertThat(jsonPath.getString("system"), equalTo("system"));
    assertThat(jsonPath.getString("period.start"), equalTo(null));
    assertThat(jsonPath.getString("value"), equalTo("value"));
    assertThat(jsonPath.getInt("rank"), equalTo(1));
}
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