[Clirr-devel] CVS: clirr/core/src/test/net/sf/clirr/core/internal/checks TestDiffListener.java,1.2,1
Status: Alpha
Brought to you by:
lkuehne
From: Simon K. <s_k...@us...> - 2004-07-18 01:12:52
|
Update of /cvsroot/clirr/clirr/core/src/test/net/sf/clirr/core/internal/checks In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28118 Modified Files: TestDiffListener.java Log Message: Generate nice error message if an unexpected diff is encountered during a test. New code is needed because the toString() method of the ApiDifference class no longer generates a "report" string [because it needs a MessageTranslator parameter]. Index: TestDiffListener.java =================================================================== RCS file: /cvsroot/clirr/clirr/core/src/test/net/sf/clirr/core/internal/checks/TestDiffListener.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- TestDiffListener.java 16 Jul 2004 09:09:23 -0000 1.2 +++ TestDiffListener.java 18 Jul 2004 01:12:42 -0000 1.3 @@ -59,10 +59,12 @@ } } - for (Iterator it = diffs.iterator(); it.hasNext();) { + StringBuffer buf = null; + for (Iterator it = diffs.iterator(); it.hasNext();) + { ApiDifference actual = (ApiDifference) it.next(); - // see if the generated diff is in fact in the expected set + // see if the actual (generated) diff is in the expected set boolean found = false; for(int i=0; i<expectedDiffs.length && !found; ++i) { @@ -71,8 +73,23 @@ if (!found) { - TestCase.fail("unexpected diff " + actual); + if (buf == null) + { + buf = new StringBuffer(); + buf.append("Unexpected diffs: "); + } + else + { + buf.append(", "); + } + buf.append(actual.toString(translator)); } } + + if (buf != null) + { + // we must have found at least one unexpected diff + TestCase.fail(buf.toString()); + } } } |