use of com.b2international.snowowl.fhir.core.model.dt.Parameters.Fhir in project snow-owl by b2ihealthcare.
the class PropertySerializationTest method dateTimePropertyTest.
@Test
public void dateTimePropertyTest() throws Exception {
Date date = Dates.parse("2018-03-09T20:50:21.000+0100", FhirDates.DATE_TIME_FORMAT);
Property property = Property.builder().code("123").valueDateTime(date).description("propertyDescription").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(3));
assertThat(jsonPath, FhirParameterMatcher.hasParameter("code", FhirDataType.CODE, "123"));
assertThat(jsonPath, FhirParameterMatcher.hasParameter("value", FhirDataType.DATETIME, "2018-03-09T19:50:21.000+0000"));
assertThat(jsonPath, FhirParameterMatcher.hasParameter("description", FhirDataType.STRING, "propertyDescription"));
}
use of com.b2international.snowowl.fhir.core.model.dt.Parameters.Fhir 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"));
}
use of com.b2international.snowowl.fhir.core.model.dt.Parameters.Fhir in project snow-owl by b2ihealthcare.
the class TranslateResultSerializationTest method validResultTest.
@Test
public void validResultTest() throws Exception {
Match match = Match.builder().equivalence(ConceptMapEquivalence.EQUAL).build();
Match match2 = Match.builder().equivalence(ConceptMapEquivalence.DISJOINT).build();
TranslateResult translateResult = TranslateResult.builder().message("This is a test result").addMatch(match).addMatch(match2).build();
Fhir fhirParameters = new Parameters.Fhir(translateResult);
Parameter parameter = fhirParameters.getByName("result").get();
Boolean result = (Boolean) parameter.getValue();
assertEquals(true, result.booleanValue());
parameter = fhirParameters.getByName("message").get();
String message = (String) parameter.getValue();
assertEquals("This is a test result", message);
parameter = fhirParameters.getByName("match").get();
Parameters matchParameters = (Parameters) parameter.getValue();
parameter = matchParameters.getByName("equivalence").get();
assertEquals("equal", ((Code) parameter.getValue()).getCodeValue());
}
use of com.b2international.snowowl.fhir.core.model.dt.Parameters.Fhir in project snow-owl by b2ihealthcare.
the class TranslateResultSerializationTest method falseResultTest.
@Test
public void falseResultTest() throws Exception {
TranslateResult translateResult = TranslateResult.builder().build();
Fhir fhirParameters = new Parameters.Fhir(translateResult);
JsonPath jsonPath = JsonPath.from(objectMapper.writeValueAsString(fhirParameters));
assertThat(jsonPath.getString("resourceType"), equalTo("Parameters"));
assertThat(jsonPath.getList("parameter").size(), is(1));
assertThat(jsonPath, FhirParameterMatcher.hasParameter("result", FhirDataType.BOOLEAN, false));
}
use of com.b2international.snowowl.fhir.core.model.dt.Parameters.Fhir in project snow-owl by b2ihealthcare.
the class TranslateResultSerializationTest method parameterizedTest.
@Test
public void parameterizedTest() throws Exception {
TranslateResult translateResult = TranslateResult.builder().build();
Fhir fhirParameters = new Parameters.Fhir(translateResult);
JsonPath jsonPath = JsonPath.from(objectMapper.writeValueAsString(fhirParameters));
assertThat(jsonPath.getString("resourceType"), equalTo("Parameters"));
assertThat(jsonPath.getList("parameter").size(), is(1));
assertThat(jsonPath, FhirParameterMatcher.hasParameter("result", FhirDataType.BOOLEAN, false));
}
Aggregations