use of org.ehrbase.client.classgenerator.olddtoexamples.coronaanamnesecomposition.CoronaAnamneseComposition in project openEHR_SDK by ehrbase.
the class OldDtoModelTest method testFlattenCorona.
@Test
public void testFlattenCorona() throws IOException {
Composition composition = new CanonicalJson().unmarshal(IOUtils.toString(CompositionTestDataCanonicalJson.CORONA.getStream(), StandardCharsets.UTF_8), Composition.class);
Flattener cut = new Flattener(new TestDataTemplateProvider());
CoronaAnamneseComposition actual = cut.flatten(composition, CoronaAnamneseComposition.class);
assertThat(actual).isNotNull();
assertThat(actual.getSymptome()).isNotNull();
assertThat(actual.getSymptome().getHeiserkeit()).isNotNull();
assertThat(actual.getSymptome().getHeiserkeit().getVorhandenDefiningcode()).isEqualTo(VorhandenDefiningcode.NICHT_VORHANDEN);
}
use of org.ehrbase.client.classgenerator.olddtoexamples.coronaanamnesecomposition.CoronaAnamneseComposition in project openEHR_SDK by ehrbase.
the class OldDtoModelTest method testUnflattenCorona.
@Test
public void testUnflattenCorona() throws IOException {
Composition expected = new CanonicalJson().unmarshal(IOUtils.toString(CompositionTestDataCanonicalJson.CORONA.getStream(), StandardCharsets.UTF_8), Composition.class);
Flattener flattener = new Flattener(new TestDataTemplateProvider());
CoronaAnamneseComposition coronaAnamneseComposition = flattener.flatten(expected, CoronaAnamneseComposition.class);
Unflattener cut = new Unflattener(new TestDataTemplateProvider());
Composition actual = (Composition) cut.unflatten(coronaAnamneseComposition);
assertThat(actual).isNotNull();
assertThat(actual.getContent()).extracting(Locatable::getNameAsString, Locatable::getArchetypeNodeId).containsExactlyInAnyOrder(actual.getContent().stream().map(c -> new Tuple(c.getNameAsString(), c.getArchetypeNodeId())).toArray(Tuple[]::new));
}
Aggregations