Exemplo n.º 1
0
 private StringBuffer checkDifferences(
     StringBuffer errors,
     String prefix,
     URI leftURI,
     URI rightURI,
     Collection<EcoreDifference> differences) {
   if (differences.size() > 0) {
     if (errors == null) errors = new StringBuffer();
     else errors.append("\n  ");
     errors.append(differences.size() + prefix + "model differences between\n  ");
     errors.append(leftURI);
     errors.append("\n  ");
     errors.append(rightURI);
     for (EcoreDifference difference : differences) {
       errors.append("\n");
       errors.append(difference.toString());
     }
   }
   return errors;
 }
Exemplo n.º 2
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());
 }