use of org.ehrbase.client.classgenerator.examples.ehrbasemultioccurrencedev1composition.definition.BodyTemperatureLocationOfMeasurementChoice in project openEHR_SDK by ehrbase.
the class FlattenerTest method testFlattenEhrbaseMultiOccurrenceDeV1.
@Test
public void testFlattenEhrbaseMultiOccurrenceDeV1() {
Flattener cut = new Flattener(new TestDataTemplateProvider());
EhrbaseMultiOccurrenceDeV1Composition bloodPressureSimpleDeV0 = TestData.buildEhrbaseMultiOccurrenceDeV1();
RMObject rmObject = new Unflattener(new TestDataTemplateProvider()).unflatten(bloodPressureSimpleDeV0);
EhrbaseMultiOccurrenceDeV1Composition actual = cut.flatten((Locatable) rmObject, EhrbaseMultiOccurrenceDeV1Composition.class);
assertThat(actual).isNotNull();
assertThat(actual.getBodyTemperature()).size().isEqualTo(2);
BodyTemperatureObservation bodyTemperature1 = actual.getBodyTemperature().get(0);
assertThat(bodyTemperature1.getAnyEvent()).extracting(e -> ((BodyTemperatureAnyEventPointEvent) e).getTemperatureMagnitude()).containsExactlyInAnyOrder(11d, 22d);
BodyTemperatureLocationOfMeasurementChoice locationOfMeasurement1 = bodyTemperature1.getLocationOfMeasurement();
assertThat(locationOfMeasurement1.getClass()).isEqualTo(BodyTemperatureLocationOfMeasurementDvCodedText.class);
assertThat(((BodyTemperatureLocationOfMeasurementDvCodedText) locationOfMeasurement1).getLocationOfMeasurementDefiningCode()).isEqualTo(LocationOfMeasurementDefiningCode.FOREHEAD);
BodyTemperatureObservation bodyTemperature2 = actual.getBodyTemperature().get(1);
BodyTemperatureLocationOfMeasurementChoice locationOfMeasurement2 = bodyTemperature2.getLocationOfMeasurement();
assertThat(locationOfMeasurement2.getClass()).isEqualTo(BodyTemperatureLocationOfMeasurementDvText.class);
assertThat(((BodyTemperatureLocationOfMeasurementDvText) locationOfMeasurement2).getLocationOfMeasurementValue()).isEqualTo("location");
}
Aggregations