Ejemplo n.º 1
0
 protected void assertNoDifferences(EquivalenceMap ecoreComparator, URI leftURI, URI rightURI) {
   List<EcoreDifference> differences = ecoreComparator.computeDifferences();
   Collections.sort(differences);
   StringBuffer s = null;
   s = checkDifferences(s, " ", leftURI, rightURI, differences);
   if (s != null) fail(s.toString());
 }
Ejemplo n.º 2
0
 protected void assertSameModel(
     EquivalenceHelper helper,
     URI projectURI,
     Resource resource1,
     URI referenceURI,
     EquivalenceMap.ContentPredicate contentPredicate)
     throws IOException {
   assertTrue(
       "Resource Set should contain resource", resourceSet.getResources().contains(resource1));
   assertNotNull("Null project URI", projectURI);
   assertNotNull("Null parsed resource", resource1);
   assertNotNull("Null reference URI", referenceURI);
   URI uri = resource1.getURI();
   assertNotNull(uri);
   Resource resource2 = resourceSet.getResource(referenceURI, true);
   EquivalenceMap ecoreComparator =
       new EquivalenceMap(helper, resource1, resource2, contentPredicate);
   ecoreComparator.setURI(projectURI);
   assertNoDifferences(ecoreComparator, uri, referenceURI);
 }
Ejemplo n.º 3
0
 protected void assertDifferencesEquals(
     EquivalenceMap ecoreComparator,
     URI leftURI,
     URI rightURI,
     Set<EcoreDifference> expectedDifferences) {
   List<EcoreDifference> actualDifferences = ecoreComparator.computeDifferences();
   List<EcoreDifference> extraDifferences = new ArrayList<EcoreDifference>();
   for (EcoreDifference expectedDifference : expectedDifferences) {
     EcoreDifference gotIt = null;
     for (EcoreDifference actualDifference : actualDifferences) {
       if (expectedDifference.isSameLeftElseRight(actualDifference)) gotIt = actualDifference;
     }
     if (gotIt != null) actualDifferences.remove(gotIt);
     else extraDifferences.add(expectedDifference);
   }
   Collections.sort(actualDifferences);
   Collections.sort(extraDifferences);
   StringBuffer s = null;
   s = checkDifferences(s, " missing ", leftURI, rightURI, actualDifferences);
   s = checkDifferences(s, " extra ", leftURI, rightURI, extraDifferences);
   if (s != null) fail(s.toString());
 }