vdkoogh 2003/12/30 01:40:55
Modified: src_unitTests/org/apache/xml/security/test/c14n/helper
AttrCompareTest.java
Log:
Replaced assertEquals on -1 and 1 to assertTrue < 0 and > 0 according to
Comperator contract
CVS: ----------------------------------------------------------------------
CVS: PR:
CVS: If this change addresses a PR in the problem report tracking
CVS: database, then enter the PR number(s) here.
CVS: Obtained from:
CVS: If this change has been taken from another system, such as NCSA,
CVS: then name the system in this line, otherwise delete it.
CVS: Submitted by:
CVS: If this code has been contributed to Apache by someone else; i.e.,
CVS: they sent us a patch or a new module, then include their name/email
CVS: address here. If this is your work then delete this line.
CVS: Reviewed by:
CVS: If we are doing pre-commit code reviews and someone else has
CVS: reviewed your changes, include their name(s) here.
CVS: If you have not had it reviewed then delete this line.
Revision Changes Path
1.7 +10 -19
xml-security/src_unitTests/org/apache/xml/security/test/c14n/helper/AttrCompareTest.java
Index: AttrCompareTest.java
===================================================================
RCS file:
/home/cvs/xml-security/src_unitTests/org/apache/xml/security/test/c14n/helper/AttrCompareTest.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- AttrCompareTest.java 26 Dec 2003 11:20:39 -0000 1.6
+++ AttrCompareTest.java 30 Dec 2003 09:40:55 -0000 1.7
@@ -188,27 +188,23 @@
AttrCompare attrCompare = new AttrCompare();
- assertEquals("attrCompare.compare((Object) attr0, (Object) attr1)", -1,
- attrCompare.compare(attr0, attr1));
- assertEquals("attrCompare.compare((Object) attr1, (Object) attr0)", 1,
- attrCompare.compare(attr1, attr0));
+ assertTrue(attr0 + " < " + attr1, attrCompare.compare(attr0, attr1) <
0);
+ assertTrue(attr1 + " < " + attr0, attrCompare.compare(attr1, attr0) >
0);
}
public static void testA2() throws ParserConfigurationException {
Document doc = createDoc("documentElement");
- Attr attr0 = doc.createAttributeNS("http://goo", "goo:foo");
- Attr attr1 = doc.createAttributeNS(null, "foo");
+ Attr attr0 = doc.createAttributeNS(null, "foo");
+ Attr attr1 = doc.createAttributeNS("http://goo", "goo:foo");
System.out.println("Attr1: " + attr1 + " (" + attr1.getLocalName()
+")");
AttrCompare attrCompare = new AttrCompare();
- assertEquals("attrCompare.compare((Object) attr0, (Object) attr1)", 1,
- attrCompare.compare(attr0, attr1));
- assertEquals("attrCompare.compare((Object) attr1, (Object) attr0)", -1,
- attrCompare.compare(attr1, attr0));
+ assertTrue(attr0 + " < " + attr1, attrCompare.compare(attr0, attr1) <
0);
+ assertTrue(attr1 + " < " + attr0, attrCompare.compare(attr1, attr0) >
0);
}
@@ -240,10 +236,8 @@
AttrCompare attrCompare = new AttrCompare();
- assertEquals("attrCompare.compare((Object) attr0, (Object) attr1)", -1,
- attrCompare.compare(attr0, attr1));
- assertEquals("attrCompare.compare((Object) attr1, (Object) attr0)", 1,
- attrCompare.compare(attr1, attr0));
+ assertTrue(attr0 + " < " + attr1, attrCompare.compare(attr0, attr1) <
0);
+ assertTrue(attr1 + " < " + attr0, attrCompare.compare(attr1, attr0) >
0);
}
/**
@@ -300,11 +294,8 @@
for (int j = i + 1; j < attrs.length; j++) {
Attr attr0 = attrs[i];
Attr attr1 = attrs[j];
- assertEquals(attr0 + " > " + attr1,
- -1,
- attrCompare.compare(attr0, attr1));
- assertEquals(attr0 + " < " + attr1,
- 1, attrCompare.compare(attr0, attr1));
+ assertTrue(attr0 + " < " + attr1, attrCompare.compare(attr0,
attr1) < 0);
+ assertTrue(attr1 + " < " + attr0, attrCompare.compare(attr1,
attr0) > 0);
}
}
}