use of org.javers.core.diff.Diff in project fhir-bridge by ehrbase.
the class AbstractMappingTestSetupIT method compareCompositions.
public Diff compareCompositions(Javers javers, String paragonFilePath, CompositionEntity mappedComposition) throws IOException {
RMObject composition = new CanonicalJson().unmarshal(testFileLoader.loadResourceToString(paragonFilePath), com.nedap.archie.rm.composition.Composition.class);
ResourceTemplateProvider resourceTemplateProvider = new ResourceTemplateProvider("classpath:/opt/");
resourceTemplateProvider.afterPropertiesSet();
Flattener cut = new Flattener(resourceTemplateProvider);
CompositionEntity paragonComposition = cut.flatten(composition, mappedComposition.getClass());
Diff diff = javers.compare(paragonComposition, mappedComposition);
diff.getChanges().forEach(System.out::println);
return diff;
}
use of org.javers.core.diff.Diff in project molgenis-emx2 by molgenis.
the class CompareTools method assertEquals.
public static void assertEquals(SchemaMetadata schema1, SchemaMetadata schema2) {
Collection<String> tableNames1 = schema1.getTableNames();
Collection<String> tableNames2 = schema2.getTableNames();
for (Object tableName : tableNames1) if (!tableNames2.contains(tableName))
fail("Schema's have different tables: schema2 doesn't contain '" + tableName + "'");
for (Object tableName : tableNames2) if (!tableNames1.contains(tableName))
fail("Schema's have different tables: schema1 doesn't contain '" + tableName + "'");
for (String tableName : tableNames1) {
Diff diff = getJavers().compare(schema1.getTableMetadata(tableName), schema2.getTableMetadata(tableName));
if (diff.hasChanges()) {
fail("Roundtrip test failed: changes for table " + tableName + ": " + diff.toString());
}
}
}
Aggregations