use of org.ehrbase.test_data.composition.CompositionTestDataStructuredJson in project openEHR_SDK by ehrbase.
the class StructuredJsonTest method testRoundTripCorona.
@Test
void testRoundTripCorona() throws IOException {
CompositionTestDataStructuredJson testData = CompositionTestDataStructuredJson.CORONA;
String templateId = OperationalTemplateTestData.CORONA_ANAMNESE.getTemplateId();
test(testData, templateId);
}
use of org.ehrbase.test_data.composition.CompositionTestDataStructuredJson in project openEHR_SDK by ehrbase.
the class StructuredJsonTest method test.
private void test(CompositionTestDataStructuredJson testData, String templateId) throws IOException {
RMDataFormat cut = new FlatJasonProvider(templateProvider).buildFlatJson(FlatFormat.STRUCTURED, templateId);
String flat = IOUtils.toString(testData.getStream(), StandardCharsets.UTF_8);
Composition unmarshal = cut.unmarshal(flat);
SoftAssertions softAssertions = new SoftAssertions();
softAssertions.assertThat(unmarshal).isNotNull();
RMObjectValidator rmObjectValidator = new RMObjectValidator(ArchieRMInfoLookup.getInstance(), s -> null);
softAssertions.assertThat(rmObjectValidator.validate(unmarshal)).filteredOn(m -> !m.getMessage().contains("Inv_null_flavour_indicated")).containsExactlyInAnyOrder();
String actual = cut.marshal(unmarshal);
String expected = IOUtils.toString(testData.getStream(), StandardCharsets.UTF_8);
JSONAssert.assertEquals(expected, actual, JSONCompareMode.NON_EXTENSIBLE);
}
use of org.ehrbase.test_data.composition.CompositionTestDataStructuredJson in project openEHR_SDK by ehrbase.
the class StructuredHelperTest method convert.
@Test
public void convert() throws IOException {
CompositionTestDataStructuredJson structuredJson = CompositionTestDataStructuredJson.CORONA;
CompositionTestDataSimSDTJson simSDTJson = CompositionTestDataSimSDTJson.CORONA;
String templateId = OperationalTemplateTestData.CORONA_ANAMNESE.getTemplateId();
testStructuredToFlat(structuredJson, simSDTJson, templateId);
}
use of org.ehrbase.test_data.composition.CompositionTestDataStructuredJson in project openEHR_SDK by ehrbase.
the class StructuredHelperTest method convertRevert.
@Test
public void convertRevert() throws IOException {
CompositionTestDataStructuredJson structuredJson = CompositionTestDataStructuredJson.CORONA;
CompositionTestDataSimSDTJson simSDTJson = CompositionTestDataSimSDTJson.CORONA;
testFlatToStructured(structuredJson, simSDTJson);
}
use of org.ehrbase.test_data.composition.CompositionTestDataStructuredJson in project openEHR_SDK by ehrbase.
the class StructuredHelperTest method convertRevertMultiList.
@Test
public void convertRevertMultiList() throws IOException {
CompositionTestDataStructuredJson structuredJson = CompositionTestDataStructuredJson.MULTI_LIST;
CompositionTestDataSimSDTJson simSDTJson = CompositionTestDataSimSDTJson.MULTI_LIST;
testFlatToStructured(structuredJson, simSDTJson);
}
Aggregations