use of io.restassured.path.json.JsonPath in project snow-owl by b2ihealthcare.
the class SignatureTest method serializeWithReference.
@Test
public void serializeWithReference() throws Exception {
DateFormat df = new SimpleDateFormat(FhirDates.DATE_TIME_FORMAT);
Date date = df.parse(TEST_DATE_STRING);
Instant instant = Instant.builder().instant(date).build();
Signature signature = Signature.builder().addType(Coding.builder().build()).contentType(new Code("contentTypeCode")).when(instant).whoReference(Reference.builder().reference("reference").identifier(Identifier.builder().build()).display("display").build()).onBehalfOfUri(new Uri("onBehalfUri")).blob("blob".getBytes()).build();
JsonPath jsonPath = JsonPath.from(objectMapper.writeValueAsString(signature));
assertThat(jsonPath.getString("when"), equalTo("2018-03-23T07:49:40Z"));
jsonPath.setRoot("whoReference");
assertThat(jsonPath.getString("reference"), equalTo("reference"));
assertThat(jsonPath.getString("identifier.system"), equalTo(null));
assertThat(jsonPath.getString("display"), equalTo("display"));
}
use of io.restassured.path.json.JsonPath in project snow-owl by b2ihealthcare.
the class SignatureTest method serialize.
@Test
public void serialize() throws Exception {
JsonPath jsonPath = JsonPath.from(objectMapper.writeValueAsString(signature));
assertThat(jsonPath.getString("when"), equalTo("2018-03-23T07:49:40Z"));
assertThat(jsonPath.getString("whoUri"), equalTo("whoUri"));
assertThat(jsonPath.getString("onBehalfOfUri"), equalTo("onBehalfUri"));
assertThat(jsonPath.getString("contentType"), equalTo("contentTypeCode"));
assertThat(jsonPath.getString("type[0].code"), equalTo("codingCode"));
assertThat(jsonPath.getString("type[0].display"), equalTo("codingDisplay"));
List<Byte> blobList = jsonPath.getList("blob");
byte[] bytes = Bytes.toArray(blobList);
assertEquals("blob", new String(bytes));
}
use of io.restassured.path.json.JsonPath in project snow-owl by b2ihealthcare.
the class CodingTest method serialize.
@Test
public void serialize() throws Exception {
Coding coding = Coding.builder().code("1234").system("http://www.whocc.no/atc").version("20180131").build();
JsonPath jsonPath = JsonPath.from(objectMapper.writeValueAsString(coding));
assertThat(jsonPath.getString("code"), equalTo("1234"));
assertThat(jsonPath.getString("system"), equalTo("http://www.whocc.no/atc"));
assertThat(jsonPath.getString("version"), equalTo("20180131"));
}
use of io.restassured.path.json.JsonPath in project snow-owl by b2ihealthcare.
the class DesignationSerializationTest method designationTest.
@Test
public void designationTest() throws Exception {
Coding coding = Coding.builder().code("1234").system("http://www.whocc.no/atc").version("20180131").build();
Designation designation = Designation.builder().languageCode("en_uk").use(coding).value("dValue").build();
Fhir fhirParameters = new Parameters.Fhir(designation);
JsonPath jsonPath = JsonPath.from(objectMapper.writeValueAsString(fhirParameters));
assertThat(jsonPath.getString("resourceType"), equalTo("Parameters"));
assertThat(jsonPath.getString("parameter[0].name"), equalTo("language"));
assertThat(jsonPath.getString("parameter[0].valueCode"), equalTo("en_uk"));
assertThat(jsonPath.getString("parameter[2].name"), equalTo("value"));
assertThat(jsonPath.getString("parameter[2].valueString"), equalTo("dValue"));
jsonPath.setRoot("parameter[1]");
assertThat(jsonPath.getString("name"), equalTo("use"));
assertThat(jsonPath.getString("valueCoding.code"), equalTo("1234"));
assertThat(jsonPath.getString("valueCoding.system"), equalTo("http://www.whocc.no/atc"));
assertThat(jsonPath.getString("valueCoding.version"), equalTo("20180131"));
}
use of io.restassured.path.json.JsonPath in project snow-owl by b2ihealthcare.
the class BindingTest method serialize.
@Test
public void serialize() throws Exception {
printPrettyJson(binding);
JsonPath jsonPath = JsonPath.from(objectMapper.writeValueAsString(binding));
assertThat(jsonPath.getString("id"), equalTo("id"));
assertThat(jsonPath.getString("strength"), equalTo("strength"));
assertThat(jsonPath.getString("description"), equalTo("bindingDescription"));
assertThat(jsonPath.getString("valueSetReference.reference"), equalTo("reference"));
}
Aggregations