commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t.@apache.org
Subject svn commit: r1476555 - /commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/list/SetUniqueListTest.java
Date Sat, 27 Apr 2013 11:23:06 GMT
Author: tn
Date: Sat Apr 27 11:23:06 2013
New Revision: 1476555

URL: http://svn.apache.org/r1476555
Log:
Reordered tests.

Modified:
    commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/list/SetUniqueListTest.java

Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/list/SetUniqueListTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/list/SetUniqueListTest.java?rev=1476555&r1=1476554&r2=1476555&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/list/SetUniqueListTest.java
(original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/list/SetUniqueListTest.java
Sat Apr 27 11:23:06 2013
@@ -25,8 +25,6 @@ import java.util.List;
 import java.util.ListIterator;
 import java.util.Set;
 
-import org.apache.commons.collections4.list.SetUniqueList;
-
 /**
  * JUnit tests.
  *
@@ -440,20 +438,6 @@ public class SetUniqueListTest<E> extend
         assertTrue(s.contains(c));
     }
 
-    //-----------------------------------------------------------------------
-    @Override
-    public String getCompatibilityVersion() {
-        return "4";
-    }
-
-//    public void testCreate() throws Exception {
-//        resetEmpty();
-//        writeExternalFormToDisk((java.io.Serializable) getCollection(), "src/test/resources/data/test/SetUniqueList.emptyCollection.version4.obj");
-//        resetFull();
-//        writeExternalFormToDisk((java.io.Serializable) getCollection(), "src/test/resources/data/test/SetUniqueList.fullCollection.version4.obj");
-//    }
-
-    // TODO: Generics
     public void testCollections304() {
         final List<String> list = new LinkedList<String>();
         final SetUniqueList<String> decoratedList = SetUniqueList.setUniqueList(list);
@@ -465,19 +449,15 @@ public class SetUniqueListTest<E> extend
         decoratedList.add(s1);
         decoratedList.add(s2);
         decoratedList.add(s3);
-
         assertEquals(3, decoratedList.size());
 
         decoratedList.set(1, s4);
-
         assertEquals(3, decoratedList.size());
 
         decoratedList.add(1, s4);
-
         assertEquals(3, decoratedList.size());
 
         decoratedList.add(1, s2);
-
         assertEquals(4, decoratedList.size());
     }
 
@@ -523,51 +503,51 @@ public class SetUniqueListTest<E> extend
     }
 
     @SuppressWarnings("unchecked")
-	public void testRetainAll() {
-    	final List<E> list = new ArrayList<E>(10);
-    	final SetUniqueList<E> uniqueList = SetUniqueList.setUniqueList(list);
-    	for (int i = 0; i < 10; ++i) {
-    		uniqueList.add((E)Integer.valueOf(i));
-    	}
-    	
-    	final Collection<E> retained = new ArrayList<E>(5);
-    	for (int i = 0; i < 5; ++i) {
-    		retained.add((E)Integer.valueOf(i * 2));
-    	}
-    	
-    	assertTrue(uniqueList.retainAll(retained));
-    	assertEquals(5, uniqueList.size());
-    	assertTrue(uniqueList.contains(Integer.valueOf(0)));
-    	assertTrue(uniqueList.contains(Integer.valueOf(2)));
-    	assertTrue(uniqueList.contains(Integer.valueOf(4)));
-    	assertTrue(uniqueList.contains(Integer.valueOf(6)));
-    	assertTrue(uniqueList.contains(Integer.valueOf(8)));
+    public void testRetainAll() {
+        final List<E> list = new ArrayList<E>(10);
+        final SetUniqueList<E> uniqueList = SetUniqueList.setUniqueList(list);
+        for (int i = 0; i < 10; ++i) {
+            uniqueList.add((E)Integer.valueOf(i));
+        }
+        
+        final Collection<E> retained = new ArrayList<E>(5);
+        for (int i = 0; i < 5; ++i) {
+            retained.add((E)Integer.valueOf(i * 2));
+        }
+        
+        assertTrue(uniqueList.retainAll(retained));
+        assertEquals(5, uniqueList.size());
+        assertTrue(uniqueList.contains(Integer.valueOf(0)));
+        assertTrue(uniqueList.contains(Integer.valueOf(2)));
+        assertTrue(uniqueList.contains(Integer.valueOf(4)));
+        assertTrue(uniqueList.contains(Integer.valueOf(6)));
+        assertTrue(uniqueList.contains(Integer.valueOf(8)));
     }
 
     @SuppressWarnings("unchecked")
-	public void testRetainAllWithInitialList() {
-    	// initialized with empty list
-    	final List<E> list = new ArrayList<E>(10);
-    	for (int i = 0; i < 5; ++i) {
-    		list.add((E)Integer.valueOf(i));
-    	}
-    	final SetUniqueList<E> uniqueList = SetUniqueList.setUniqueList(list);
-    	for (int i = 5; i < 10; ++i) {
-    		uniqueList.add((E)Integer.valueOf(i));
-    	}
-    	
-    	final Collection<E> retained = new ArrayList<E>(5);
-    	for (int i = 0; i < 5; ++i) {
-    		retained.add((E)Integer.valueOf(i * 2));
-    	}
-    	
-    	assertTrue(uniqueList.retainAll(retained));
-    	assertEquals(5, uniqueList.size());
-    	assertTrue(uniqueList.contains(Integer.valueOf(0)));
-    	assertTrue(uniqueList.contains(Integer.valueOf(2)));
-    	assertTrue(uniqueList.contains(Integer.valueOf(4)));
-    	assertTrue(uniqueList.contains(Integer.valueOf(6)));
-    	assertTrue(uniqueList.contains(Integer.valueOf(8)));
+    public void testRetainAllWithInitialList() {
+        // initialized with empty list
+        final List<E> list = new ArrayList<E>(10);
+        for (int i = 0; i < 5; ++i) {
+            list.add((E)Integer.valueOf(i));
+        }
+        final SetUniqueList<E> uniqueList = SetUniqueList.setUniqueList(list);
+        for (int i = 5; i < 10; ++i) {
+            uniqueList.add((E)Integer.valueOf(i));
+        }
+        
+        final Collection<E> retained = new ArrayList<E>(5);
+        for (int i = 0; i < 5; ++i) {
+            retained.add((E)Integer.valueOf(i * 2));
+        }
+        
+        assertTrue(uniqueList.retainAll(retained));
+        assertEquals(5, uniqueList.size());
+        assertTrue(uniqueList.contains(Integer.valueOf(0)));
+        assertTrue(uniqueList.contains(Integer.valueOf(2)));
+        assertTrue(uniqueList.contains(Integer.valueOf(4)));
+        assertTrue(uniqueList.contains(Integer.valueOf(6)));
+        assertTrue(uniqueList.contains(Integer.valueOf(8)));
     }
     
     /*
@@ -623,5 +603,18 @@ public class SetUniqueListTest<E> extend
             super(list, set);
         }
     }
+    
+    //-----------------------------------------------------------------------
+    @Override
+    public String getCompatibilityVersion() {
+        return "4";
+    }
+
+//    public void testCreate() throws Exception {
+//        resetEmpty();
+//        writeExternalFormToDisk((java.io.Serializable) getCollection(), "src/test/resources/data/test/SetUniqueList.emptyCollection.version4.obj");
+//        resetFull();
+//        writeExternalFormToDisk((java.io.Serializable) getCollection(), "src/test/resources/data/test/SetUniqueList.fullCollection.version4.obj");
+//    }
 
 }



Mime
View raw message