commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r220158 - /jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/mutable/MutableIntTest.java
Date Thu, 21 Jul 2005 18:13:36 GMT
Author: ggregory
Date: Thu Jul 21 11:13:30 2005
New Revision: 220158

URL: http://svn.apache.org/viewcvs?rev=220158&view=rev
Log:
Make testing equality more flexible.

Modified:
    jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/mutable/MutableIntTest.java

Modified: jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/mutable/MutableIntTest.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/mutable/MutableIntTest.java?rev=220158&r1=220157&r2=220158&view=diff
==============================================================================
--- jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/mutable/MutableIntTest.java
(original)
+++ jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/mutable/MutableIntTest.java
Thu Jul 21 11:13:30 2005
@@ -81,20 +81,27 @@
     }
 
     public void testEquals() {
-        final MutableInt mutNumA = new MutableInt(0);
-        final MutableInt mutNumB = new MutableInt(0);
-        final MutableInt mutNumC = new MutableInt(1);
+        this.testEquals(new MutableInt(0), new MutableInt(0), new MutableInt(1));
+        // Should Numbers be supported? GaryG July-21-2005.
+        //this.testEquals(mutNumA, new Integer(0), mutNumC);
+    }
 
-        assertEquals(true, mutNumA.equals(mutNumA));
-        assertEquals(true, mutNumA.equals(mutNumB));
-        assertEquals(true, mutNumB.equals(mutNumA));
-        assertEquals(true, mutNumB.equals(mutNumB));
-        assertEquals(false, mutNumA.equals(mutNumC));
-        assertEquals(false, mutNumB.equals(mutNumC));
-        assertEquals(true, mutNumC.equals(mutNumC));
-        assertEquals(false, mutNumA.equals(null));
-        assertEquals(false, mutNumA.equals(new Integer(0)));
-        assertEquals(false, mutNumA.equals("0"));
+    /**
+     * @param numA must not be a 0 Integer; must not equal numC.
+     * @param numB must equal numA; must not equal numC.
+     * @param numC must not equal numA; must not equal numC.
+     */
+    void testEquals(final Number numA, final Number numB, final Number numC) {
+        assertEquals(true, numA.equals(numA));
+        assertEquals(true, numA.equals(numB));
+        assertEquals(true, numB.equals(numA));
+        assertEquals(true, numB.equals(numB));
+        assertEquals(false, numA.equals(numC));
+        assertEquals(false, numB.equals(numC));
+        assertEquals(true, numC.equals(numC));
+        assertEquals(false, numA.equals(null));
+        assertEquals(false, numA.equals(new Integer(0)));
+        assertEquals(false, numA.equals("0"));
     }
 
     public void testHashCode() {



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message