use of com.b2international.snowowl.fhir.core.model.dt.SubProperty in project snow-owl by b2ihealthcare.
the class PropertySerializationTest method subPropertyTest.
@Test
public void subPropertyTest() throws Exception {
Property property = Property.builder().code("123").valueInteger(2).description("propertyDescription").addSubProperty(SubProperty.builder().code("subCode").description("subDescription").valueInteger(1).build()).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(4));
assertThat(jsonPath, FhirParameterMatcher.hasParameter("code", FhirDataType.CODE, "123"));
assertThat(jsonPath, FhirParameterMatcher.hasParameter("value", FhirDataType.INTEGER, 2));
assertThat(jsonPath, FhirParameterMatcher.hasParameter("description", FhirDataType.STRING, "propertyDescription"));
assertThat(jsonPath.getString("parameter[3].name"), equalTo("subproperty"));
assertThat(jsonPath.getString("parameter[3].part[0].name"), equalTo("code"));
assertThat(jsonPath.getString("parameter[3].part[0].valueCode"), equalTo("subCode"));
assertThat(jsonPath.getString("parameter[3].part[1].name"), equalTo("value"));
assertThat(jsonPath.getInt("parameter[3].part[1].valueInteger"), equalTo(1));
assertThat(jsonPath.getString("parameter[3].part[2].name"), equalTo("description"));
assertThat(jsonPath.getString("parameter[3].part[2].valueString"), equalTo("subDescription"));
}
Aggregations