commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t.@apache.org
Subject svn commit: r1443623 - in /commons/proper/collections/trunk/src/test/java/org/apache/commons/collections: CollectionUtilsTest.java EnumerationUtilsTest.java IteratorUtilsTest.java ListUtilsTest.java
Date Thu, 07 Feb 2013 17:46:19 GMT
Author: tn
Date: Thu Feb  7 17:46:17 2013
New Revision: 1443623

URL: http://svn.apache.org/viewvc?rev=1443623&view=rev
Log:
Fix some warnings wrt deprecated junit methods.

Modified:
    commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/CollectionUtilsTest.java
    commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/EnumerationUtilsTest.java
    commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/IteratorUtilsTest.java
    commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/ListUtilsTest.java

Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/CollectionUtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/CollectionUtilsTest.java?rev=1443623&r1=1443622&r2=1443623&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/CollectionUtilsTest.java
(original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/CollectionUtilsTest.java
Thu Feb  7 17:46:17 2013
@@ -16,12 +16,12 @@
  */
 package org.apache.commons.collections;
 
-import static junit.framework.Assert.assertFalse;
 import static org.apache.commons.collections.functors.EqualPredicate.equalPredicate;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertSame;
 import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.fail;
 
 import java.util.*;

Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/EnumerationUtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/EnumerationUtilsTest.java?rev=1443623&r1=1443622&r2=1443623&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/EnumerationUtilsTest.java
(original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/EnumerationUtilsTest.java
Thu Feb  7 17:46:17 2013
@@ -21,7 +21,6 @@ import java.util.Hashtable;
 import java.util.List;
 import java.util.StringTokenizer;
 
-import junit.framework.Assert;
 import junit.framework.Test;
 
 /**
@@ -50,9 +49,9 @@ public class EnumerationUtilsTest extend
         expectedList2.add("a");
         expectedList2.add("test");
         final List<String> actualList = EnumerationUtils.toList(new StringTokenizer(TO_LIST_FIXTURE));
-        Assert.assertEquals(expectedList1, expectedList2);
-        Assert.assertEquals(expectedList1, actualList);
-        Assert.assertEquals(expectedList2, actualList);
+        assertEquals(expectedList1, expectedList2);
+        assertEquals(expectedList1, actualList);
+        assertEquals(expectedList2, actualList);
     }
 
     public void testToListWithHashtable() {
@@ -62,27 +61,27 @@ public class EnumerationUtilsTest extend
         expected.put("three", new Integer(3));
         // validate elements.
         final List<Integer> actualEltList = EnumerationUtils.toList(expected.elements());
-        Assert.assertEquals(expected.size(), actualEltList.size());
-        Assert.assertTrue(actualEltList.contains(new Integer(1)));
-        Assert.assertTrue(actualEltList.contains(new Integer(2)));
-        Assert.assertTrue(actualEltList.contains(new Integer(3)));
+        assertEquals(expected.size(), actualEltList.size());
+        assertTrue(actualEltList.contains(new Integer(1)));
+        assertTrue(actualEltList.contains(new Integer(2)));
+        assertTrue(actualEltList.contains(new Integer(3)));
         final List<Integer> expectedEltList = new ArrayList<Integer>();
         expectedEltList.add(new Integer(1));
         expectedEltList.add(new Integer(2));
         expectedEltList.add(new Integer(3));
-        Assert.assertTrue(actualEltList.containsAll(expectedEltList));
+        assertTrue(actualEltList.containsAll(expectedEltList));
 
         // validate keys.
         final List<String> actualKeyList = EnumerationUtils.toList(expected.keys());
-        Assert.assertEquals(expected.size(), actualEltList.size());
-        Assert.assertTrue(actualKeyList.contains("one"));
-        Assert.assertTrue(actualKeyList.contains("two"));
-        Assert.assertTrue(actualKeyList.contains("three"));
+        assertEquals(expected.size(), actualEltList.size());
+        assertTrue(actualKeyList.contains("one"));
+        assertTrue(actualKeyList.contains("two"));
+        assertTrue(actualKeyList.contains("three"));
         final List<String> expectedKeyList = new ArrayList<String>();
         expectedKeyList.add("one");
         expectedKeyList.add("two");
         expectedKeyList.add("three");
-        Assert.assertTrue(actualKeyList.containsAll(expectedKeyList));
+        assertTrue(actualKeyList.containsAll(expectedKeyList));
     }
 
     public static Test suite() {

Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/IteratorUtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/IteratorUtilsTest.java?rev=1443623&r1=1443622&r2=1443623&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/IteratorUtilsTest.java
(original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/IteratorUtilsTest.java
Thu Feb  7 17:46:17 2013
@@ -69,7 +69,7 @@ public class IteratorUtilsTest extends B
         assertTrue(expected > 0);
 
         // single use iterator
-        for(final Integer actual : iterable) {
+        for(@SuppressWarnings("unused") final Integer actual : iterable) {
             fail("should not be able to iterate twice");
         }
     }
@@ -809,7 +809,7 @@ public class IteratorUtilsTest extends B
         assertTrue(expectedNodeIndex > 0);
 
         // single use iterator
-        for (final Node actual : IteratorUtils.asIterable(iterator)) {
+        for (@SuppressWarnings("unused") final Node actual : IteratorUtils.asIterable(iterator))
{
             fail("should not be able to iterate twice");
         }
     }
@@ -834,7 +834,7 @@ public class IteratorUtilsTest extends B
         assertTrue(expectedNodeIndex > 0);
 
         // single use iterator
-        for (final Node actual : IteratorUtils.asIterable(iterator)) {
+        for (@SuppressWarnings("unused") final Node actual : IteratorUtils.asIterable(iterator))
{
             fail("should not be able to iterate twice");
         }
     }

Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/ListUtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/ListUtilsTest.java?rev=1443623&r1=1443622&r2=1443623&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/ListUtilsTest.java
(original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/ListUtilsTest.java
Thu Feb  7 17:46:17 2013
@@ -23,7 +23,6 @@ import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
 
-import junit.framework.Assert;
 import junit.framework.Test;
 
 import org.apache.commons.collections.functors.EqualPredicate;
@@ -315,17 +314,17 @@ public class ListUtilsTest extends BulkT
         
         try {
             ListUtils.partition(null, 3);
-            Assert.fail("failed to check for null argument");
+            fail("failed to check for null argument");
         } catch (final IllegalArgumentException e) {}
         
         try {
             ListUtils.partition(strings, 0);
-            Assert.fail("failed to check for size argument");
+            fail("failed to check for size argument");
         } catch (final IllegalArgumentException e) {}
         
         try {
             ListUtils.partition(strings, -10);
-            Assert.fail("failed to check for size argument");
+            fail("failed to check for size argument");
         } catch (final IllegalArgumentException e) {}
         
     }
@@ -346,10 +345,10 @@ public class ListUtilsTest extends BulkT
         final List<Integer> output1 = ListUtils.select(list, EQUALS_TWO);
         final List<Number> output2 = ListUtils.<Number>select(list, EQUALS_TWO);
         final HashSet<Number> output3 = CollectionUtils.select(list, EQUALS_TWO, new
HashSet<Number>());
-        Assert.assertTrue(CollectionUtils.isEqualCollection(output1, output3));
-        Assert.assertEquals(4, list.size());
-        Assert.assertEquals(1, output1.size());
-        Assert.assertEquals(2, output2.iterator().next());
+        assertTrue(CollectionUtils.isEqualCollection(output1, output3));
+        assertEquals(4, list.size());
+        assertEquals(1, output1.size());
+        assertEquals(2, output2.iterator().next());
     }
 
     public void testSelectRejected() {
@@ -361,12 +360,12 @@ public class ListUtilsTest extends BulkT
         final List<Long> output1 = ListUtils.selectRejected(list, EQUALS_TWO);
         final List<? extends Number> output2 = ListUtils.selectRejected(list, EQUALS_TWO);
         final HashSet<Number> output3 = CollectionUtils.selectRejected(list, EQUALS_TWO,
new HashSet<Number>());
-        Assert.assertTrue(CollectionUtils.isEqualCollection(output1, output2));
-        Assert.assertTrue(CollectionUtils.isEqualCollection(output1, output3));
-        Assert.assertEquals(4, list.size());
-        Assert.assertEquals(3, output1.size());
-        Assert.assertTrue(output1.contains(1L));
-        Assert.assertTrue(output1.contains(3L));
-        Assert.assertTrue(output1.contains(4L));
+        assertTrue(CollectionUtils.isEqualCollection(output1, output2));
+        assertTrue(CollectionUtils.isEqualCollection(output1, output3));
+        assertEquals(4, list.size());
+        assertEquals(3, output1.size());
+        assertTrue(output1.contains(1L));
+        assertTrue(output1.contains(3L));
+        assertTrue(output1.contains(4L));
     }
 }



Mime
View raw message