use of org.ehrbase.client.classgenerator.examples.korpergrossecomposition.definition.GrosseLangeObservation in project openEHR_SDK by ehrbase.
the class FlattenerTest method testFlattenSingleEventPointEvent.
@Test
public void testFlattenSingleEventPointEvent() {
Unflattener unflattener = new Unflattener(new TestDataTemplateProvider());
KorpergrosseComposition dto = new KorpergrosseComposition();
dto.setGrosseLange(new GrosseLangeObservation());
dto.getGrosseLange().setGrosseLangeMagnitude(22d);
Composition rmObject = (Composition) unflattener.unflatten(dto);
assertThat(rmObject).isNotNull();
Flattener cut = new Flattener(new TestDataTemplateProvider());
KorpergrosseComposition actual = cut.flatten(rmObject, KorpergrosseComposition.class);
assertThat(actual.getGrosseLange().getGrosseLangeMagnitude()).isEqualTo(22d);
}
use of org.ehrbase.client.classgenerator.examples.korpergrossecomposition.definition.GrosseLangeObservation in project openEHR_SDK by ehrbase.
the class UnflattenerTest method testUnflattenSingleEvent.
@Test
public void testUnflattenSingleEvent() {
Unflattener cut = new Unflattener(new TestDataTemplateProvider());
KorpergrosseComposition dto = new KorpergrosseComposition();
dto.setGrosseLange(new GrosseLangeObservation());
dto.getGrosseLange().setGrosseLangeMagnitude(22d);
Composition rmObject = (Composition) cut.unflatten(dto);
assertThat(rmObject).isNotNull();
Object event = rmObject.itemAtPath("/content[openEHR-EHR-OBSERVATION.height.v2]/data[at0001]/events[at0002]");
assertThat(event).isNotNull();
assertThat(event.getClass()).isEqualTo(PointEvent.class);
Object quantity = ((PointEvent) event).itemAtPath("/data[at0003]/items[at0004]/value");
assertThat(quantity).isNotNull();
assertThat(quantity.getClass()).isEqualTo(DvQuantity.class);
assertThat(((DvQuantity) quantity).getMagnitude()).isEqualTo(22d);
}
use of org.ehrbase.client.classgenerator.examples.korpergrossecomposition.definition.GrosseLangeObservation in project openEHR_SDK by ehrbase.
the class FlattenerTest method testFlattenSingleEventIntervallEvent.
@Test
public void testFlattenSingleEventIntervallEvent() {
Unflattener unflattener = new Unflattener(new TestDataTemplateProvider());
KorpergrosseComposition dto = new KorpergrosseComposition();
dto.setGrosseLange(new GrosseLangeObservation());
dto.getGrosseLange().setGrosseLangeMagnitude(22d);
Composition rmObject = (Composition) unflattener.unflatten(dto);
Observation observation = (Observation) rmObject.getContent().get(0);
Event<ItemStructure> event = observation.getData().getEvents().get(0);
observation.getData().getEvents().remove(event);
IntervalEvent<ItemStructure> intervalEvent = new IntervalEvent<>();
intervalEvent.setData(event.getData());
intervalEvent.setArchetypeNodeId(event.getArchetypeNodeId());
intervalEvent.setSampleCount(10L);
observation.getData().getEvents().add(intervalEvent);
assertThat(rmObject).isNotNull();
Flattener cut = new Flattener(new TestDataTemplateProvider());
KorpergrosseComposition actual = cut.flatten(rmObject, KorpergrosseComposition.class);
assertThat(actual.getGrosseLange().getGrosseLangeMagnitude()).isEqualTo(22d);
}
Aggregations