Repository: commons-collections
Updated Branches:
  refs/heads/collections_jdk5_branch [created] 76d7c4078


http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/set/TestListOrderedSet.java
----------------------------------------------------------------------
diff --git 
a/src/test/org/apache/commons/collections/set/TestListOrderedSet.java 
b/src/test/org/apache/commons/collections/set/TestListOrderedSet.java
index 1f89bd1..19fe97d 100644
--- a/src/test/org/apache/commons/collections/set/TestListOrderedSet.java
+++ b/src/test/org/apache/commons/collections/set/TestListOrderedSet.java
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -31,11 +31,16 @@ import junit.framework.TestSuite;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Henning P. Schmiedehausen
  * @author Stephen Colebourne
  */
-public class TestListOrderedSet extends AbstractTestSet {
+public class TestListOrderedSet<E> extends AbstractTestSet<E> {
+
+    private static final Integer ZERO = new Integer(0);
+    private static final Integer ONE = new Integer(1);
+    private static final Integer TWO = new Integer(2);
+    private static final Integer THREE = new Integer(3);
 
     public TestListOrderedSet(String testName) {
         super(testName);
@@ -50,22 +55,24 @@ public class TestListOrderedSet extends AbstractTestSet {
         junit.textui.TestRunner.main(testCaseName);
     }
 
-    public Set makeEmptySet() {
-        return ListOrderedSet.decorate(new HashSet());
+    public ListOrderedSet<E> makeObject() {
+        return ListOrderedSet.decorate(new HashSet<E>());
     }
 
-    protected Set setupSet() {
-        Set set = makeEmptySet();
+    @SuppressWarnings("unchecked")
+    protected ListOrderedSet<E> setupSet() {
+        ListOrderedSet<E> set = makeObject();
 
         for (int i = 0; i < 10; i++) {
-            set.add(Integer.toString(i));
+            set.add((E) Integer.toString(i));
         }
         return set;
     }
 
+    @SuppressWarnings("unchecked")
     public void testOrdering() {
-        Set set = setupSet();
-        Iterator it = set.iterator();
+        ListOrderedSet<E> set = setupSet();
+        Iterator<E> it = set.iterator();
 
         for (int i = 0; i < 10; i++) {
             assertEquals("Sequence is wrong", Integer.toString(i), it.next());
@@ -81,7 +88,7 @@ public class TestListOrderedSet extends AbstractTestSet {
         }
 
         for (int i = 0; i < 10; i++) {
-            set.add(Integer.toString(i));
+            set.add((E) Integer.toString(i));
         }
 
         assertEquals("Size of set is wrong!", 10, set.size());
@@ -94,19 +101,15 @@ public class TestListOrderedSet extends AbstractTestSet {
             assertEquals("Sequence is wrong", Integer.toString(i), it.next());
         }
     }
-    
-    private static final Integer ZERO = new Integer(0);
-    private static final Integer ONE = new Integer(1);
-    private static final Integer TWO = new Integer(2);
-    private static final Integer THREE = new Integer(3);
-    
+
+    @SuppressWarnings("unchecked")
     public void testListAddRemove() {
-        ListOrderedSet set = (ListOrderedSet) makeEmptySet();
-        List view = set.asList();
-        set.add(ZERO);
-        set.add(ONE);
-        set.add(TWO);
-        
+        ListOrderedSet<E> set = makeObject();
+        List<E> view = set.asList();
+        set.add((E) ZERO);
+        set.add((E) ONE);
+        set.add((E) TWO);
+
         assertEquals(3, set.size());
         assertSame(ZERO, set.get(0));
         assertSame(ONE, set.get(1));
@@ -115,11 +118,11 @@ public class TestListOrderedSet extends AbstractTestSet {
         assertSame(ZERO, view.get(0));
         assertSame(ONE, view.get(1));
         assertSame(TWO, view.get(2));
-        
+
         assertEquals(0, set.indexOf(ZERO));
         assertEquals(1, set.indexOf(ONE));
         assertEquals(2, set.indexOf(TWO));
-        
+
         set.remove(1);
         assertEquals(2, set.size());
         assertSame(ZERO, set.get(0));
@@ -127,36 +130,37 @@ public class TestListOrderedSet extends AbstractTestSet {
         assertEquals(2, view.size());
         assertSame(ZERO, view.get(0));
         assertSame(TWO, view.get(1));
-    }        
-    
+    }
+
+    @SuppressWarnings("unchecked")
     public void testListAddIndexed() {
-        ListOrderedSet set = (ListOrderedSet) makeEmptySet();
-        set.add(ZERO);
-        set.add(TWO);
-        
-        set.add(1, ONE);
+        ListOrderedSet<E> set = makeObject();
+        set.add((E) ZERO);
+        set.add((E) TWO);
+
+        set.add(1, (E) ONE);
         assertEquals(3, set.size());
         assertSame(ZERO, set.get(0));
         assertSame(ONE, set.get(1));
         assertSame(TWO, set.get(2));
-        
-        set.add(0, ONE);
+
+        set.add(0, (E) ONE);
         assertEquals(3, set.size());
         assertSame(ZERO, set.get(0));
         assertSame(ONE, set.get(1));
         assertSame(TWO, set.get(2));
-        
-        List list = new ArrayList();
-        list.add(ZERO);
-        list.add(TWO);
-        
+
+        List<E> list = new ArrayList<E>();
+        list.add((E) ZERO);
+        list.add((E) TWO);
+
         set.addAll(0, list);
         assertEquals(3, set.size());
         assertSame(ZERO, set.get(0));
         assertSame(ONE, set.get(1));
         assertSame(TWO, set.get(2));
-        
-        list.add(0, THREE); // list = [3,0,2]
+
+        list.add(0, (E) THREE); // list = [3,0,2]
         set.remove(TWO);    //  set = [0,1]
         set.addAll(1, list);
         assertEquals(4, set.size());
@@ -166,13 +170,14 @@ public class TestListOrderedSet extends AbstractTestSet {
         assertSame(ONE, set.get(3));
     }
 
+    @SuppressWarnings("unchecked")
     public void testListAddReplacing() {
-        ListOrderedSet set = (ListOrderedSet) makeEmptySet();
+        ListOrderedSet<E> set = makeObject();
         A a = new A();
         B b = new B();
-        set.add(a);
+        set.add((E) a);
         assertEquals(1, set.size());
-        set.add(b);  // will match but not replace A as equal
+        set.add((E) b);  // will match but not replace A as equal
         assertEquals(1, set.size());
         assertSame(a, set.decorated().iterator().next());
         assertSame(a, set.iterator().next());
@@ -200,11 +205,11 @@ public class TestListOrderedSet extends AbstractTestSet {
 
     public void testDecorator() {
         try {
-            ListOrderedSet.decorate((List) null);
+            ListOrderedSet.decorate((List<E>) null);
             fail();
         } catch (IllegalArgumentException ex) {}
         try {
-            ListOrderedSet.decorate((Set) null);
+            ListOrderedSet.decorate((Set<E>) null);
             fail();
         } catch (IllegalArgumentException ex) {}
         try {
@@ -212,11 +217,11 @@ public class TestListOrderedSet extends AbstractTestSet {
             fail();
         } catch (IllegalArgumentException ex) {}
         try {
-            ListOrderedSet.decorate(new HashSet(), null);
+            ListOrderedSet.decorate(new HashSet<E>(), null);
             fail();
         } catch (IllegalArgumentException ex) {}
         try {
-            ListOrderedSet.decorate(null, new ArrayList());
+            ListOrderedSet.decorate(null, new ArrayList<E>());
             fail();
         } catch (IllegalArgumentException ex) {}
     }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/set/TestListOrderedSet2.java
----------------------------------------------------------------------
diff --git 
a/src/test/org/apache/commons/collections/set/TestListOrderedSet2.java 
b/src/test/org/apache/commons/collections/set/TestListOrderedSet2.java
index 7027912..e1e7a3e 100644
--- a/src/test/org/apache/commons/collections/set/TestListOrderedSet2.java
+++ b/src/test/org/apache/commons/collections/set/TestListOrderedSet2.java
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -19,7 +19,6 @@ package org.apache.commons.collections.set;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
-import java.util.Set;
 
 import junit.framework.Test;
 import junit.framework.TestSuite;
@@ -30,11 +29,16 @@ import junit.framework.TestSuite;
  *
  * @since Commons Collections 3.1
  * @version $Revision$ $Date$
- * 
+ *
  * @author Henning P. Schmiedehausen
  * @author Stephen Colebourne
  */
-public class TestListOrderedSet2 extends AbstractTestSet {
+public class TestListOrderedSet2<E> extends AbstractTestSet<E> {
+
+    private static final Integer ZERO = new Integer(0);
+    private static final Integer ONE = new Integer(1);
+    private static final Integer TWO = new Integer(2);
+    private static final Integer THREE = new Integer(3);
 
     public TestListOrderedSet2(String testName) {
         super(testName);
@@ -49,22 +53,24 @@ public class TestListOrderedSet2 extends AbstractTestSet {
         junit.textui.TestRunner.main(testCaseName);
     }
 
-    public Set makeEmptySet() {
-        return new ListOrderedSet();
+    public ListOrderedSet<E> makeObject() {
+        return new ListOrderedSet<E>();
     }
 
-    protected Set setupSet() {
-        Set set = makeEmptySet();
+    @SuppressWarnings("unchecked")
+    protected ListOrderedSet<E> setupSet() {
+        ListOrderedSet<E> set = makeObject();
 
         for (int i = 0; i < 10; i++) {
-            set.add(Integer.toString(i));
+            set.add((E) Integer.toString(i));
         }
         return set;
     }
 
+    @SuppressWarnings("unchecked")
     public void testOrdering() {
-        Set set = setupSet();
-        Iterator it = set.iterator();
+        ListOrderedSet<E> set = setupSet();
+        Iterator<E> it = set.iterator();
 
         for (int i = 0; i < 10; i++) {
             assertEquals("Sequence is wrong", Integer.toString(i), it.next());
@@ -80,7 +86,7 @@ public class TestListOrderedSet2 extends AbstractTestSet {
         }
 
         for (int i = 0; i < 10; i++) {
-            set.add(Integer.toString(i));
+            set.add((E) Integer.toString(i));
         }
 
         assertEquals("Size of set is wrong!", 10, set.size());
@@ -93,19 +99,15 @@ public class TestListOrderedSet2 extends AbstractTestSet {
             assertEquals("Sequence is wrong", Integer.toString(i), it.next());
         }
     }
-    
-    private static final Integer ZERO = new Integer(0);
-    private static final Integer ONE = new Integer(1);
-    private static final Integer TWO = new Integer(2);
-    private static final Integer THREE = new Integer(3);
-    
+
+    @SuppressWarnings("unchecked")
     public void testListAddRemove() {
-        ListOrderedSet set = (ListOrderedSet) makeEmptySet();
-        List view = set.asList();
-        set.add(ZERO);
-        set.add(ONE);
-        set.add(TWO);
-        
+        ListOrderedSet<E> set = makeObject();
+        List<E> view = set.asList();
+        set.add((E) ZERO);
+        set.add((E) ONE);
+        set.add((E) TWO);
+
         assertEquals(3, set.size());
         assertSame(ZERO, set.get(0));
         assertSame(ONE, set.get(1));
@@ -114,11 +116,11 @@ public class TestListOrderedSet2 extends AbstractTestSet {
         assertSame(ZERO, view.get(0));
         assertSame(ONE, view.get(1));
         assertSame(TWO, view.get(2));
-        
+
         assertEquals(0, set.indexOf(ZERO));
         assertEquals(1, set.indexOf(ONE));
         assertEquals(2, set.indexOf(TWO));
-        
+
         set.remove(1);
         assertEquals(2, set.size());
         assertSame(ZERO, set.get(0));
@@ -126,37 +128,37 @@ public class TestListOrderedSet2 extends AbstractTestSet {
         assertEquals(2, view.size());
         assertSame(ZERO, view.get(0));
         assertSame(TWO, view.get(1));
-    }        
-    
+    }
+
+    @SuppressWarnings("unchecked")
     public void testListAddIndexed() {
-        ListOrderedSet set = (ListOrderedSet) makeEmptySet();
-        List view = set.asList();
-        set.add(ZERO);
-        set.add(TWO);
-        
-        set.add(1, ONE);
+        ListOrderedSet<E> set = makeObject();
+        set.add((E) ZERO);
+        set.add((E) TWO);
+
+        set.add(1, (E) ONE);
         assertEquals(3, set.size());
         assertSame(ZERO, set.get(0));
         assertSame(ONE, set.get(1));
         assertSame(TWO, set.get(2));
-        
-        set.add(0, ONE);
+
+        set.add(0, (E) ONE);
         assertEquals(3, set.size());
         assertSame(ZERO, set.get(0));
         assertSame(ONE, set.get(1));
         assertSame(TWO, set.get(2));
-        
-        List list = new ArrayList();
-        list.add(ZERO);
-        list.add(TWO);
-        
+
+        List<E> list = new ArrayList<E>();
+        list.add((E) ZERO);
+        list.add((E) TWO);
+
         set.addAll(0, list);
         assertEquals(3, set.size());
         assertSame(ZERO, set.get(0));
         assertSame(ONE, set.get(1));
         assertSame(TWO, set.get(2));
-        
-        list.add(0, THREE); // list = [3,0,2]
+
+        list.add(0, (E) THREE); // list = [3,0,2]
         set.remove(TWO);    //  set = [0,1]
         set.addAll(1, list);
         assertEquals(4, set.size());
@@ -165,7 +167,7 @@ public class TestListOrderedSet2 extends AbstractTestSet {
         assertSame(TWO, set.get(2));
         assertSame(ONE, set.get(3));
     }
-    
+
     public String getCompatibilityVersion() {
         return "3.1";
     }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/set/TestMapBackedSet.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/set/TestMapBackedSet.java 
b/src/test/org/apache/commons/collections/set/TestMapBackedSet.java
index 4cfc1d9..8113f40 100644
--- a/src/test/org/apache/commons/collections/set/TestMapBackedSet.java
+++ b/src/test/org/apache/commons/collections/set/TestMapBackedSet.java
@@ -31,7 +31,7 @@ import org.apache.commons.collections.map.HashedMap;
  * 
  * @author Stephen Colebourne
  */
-public class TestMapBackedSet extends AbstractTestSet {
+public class TestMapBackedSet<E> extends AbstractTestSet<E> {
 
     public TestMapBackedSet(String testName) {
         super(testName);
@@ -46,8 +46,8 @@ public class TestMapBackedSet extends AbstractTestSet {
         junit.textui.TestRunner.main(testCaseName);
     }
 
-    public Set makeEmptySet() {
-        return MapBackedSet.decorate(new HashedMap());
+    public Set<E> makeObject() {
+        return MapBackedSet.decorate(new HashedMap<E, Object>());
     }
 
     public String getCompatibilityVersion() {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/set/TestMapBackedSet2.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/set/TestMapBackedSet2.java 
b/src/test/org/apache/commons/collections/set/TestMapBackedSet2.java
index 23449a5..b32f338 100644
--- a/src/test/org/apache/commons/collections/set/TestMapBackedSet2.java
+++ b/src/test/org/apache/commons/collections/set/TestMapBackedSet2.java
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -29,10 +29,10 @@ import org.apache.commons.collections.map.LinkedMap;
  *
  * @since Commons Collections 3.1
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
-public class TestMapBackedSet2 extends AbstractTestSet {
+public class TestMapBackedSet2<E> extends AbstractTestSet<E> {
 
     public TestMapBackedSet2(String testName) {
         super(testName);
@@ -47,22 +47,24 @@ public class TestMapBackedSet2 extends AbstractTestSet {
         junit.textui.TestRunner.main(testCaseName);
     }
 
-    public Set makeEmptySet() {
-        return MapBackedSet.decorate(new LinkedMap());
+    public Set<E> makeObject() {
+        return MapBackedSet.decorate(new LinkedMap<E, Object>());
     }
 
-    protected Set setupSet() {
-        Set set = makeEmptySet();
+    @SuppressWarnings("unchecked")
+    protected Set<E> setupSet() {
+        Set<E> set = makeObject();
 
         for (int i = 0; i < 10; i++) {
-            set.add(Integer.toString(i));
+            set.add((E) Integer.toString(i));
         }
         return set;
     }
 
+    @SuppressWarnings("unchecked")
     public void testOrdering() {
-        Set set = setupSet();
-        Iterator it = set.iterator();
+        Set<E> set = setupSet();
+        Iterator<E> it = set.iterator();
 
         for (int i = 0; i < 10; i++) {
             assertEquals("Sequence is wrong", Integer.toString(i), it.next());
@@ -78,7 +80,7 @@ public class TestMapBackedSet2 extends AbstractTestSet {
         }
 
         for (int i = 0; i < 10; i++) {
-            set.add(Integer.toString(i));
+            set.add((E) Integer.toString(i));
         }
 
         assertEquals("Size of set is wrong!", 10, set.size());

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/set/TestPredicatedSet.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/set/TestPredicatedSet.java 
b/src/test/org/apache/commons/collections/set/TestPredicatedSet.java
index cb330bc..e9848dd 100644
--- a/src/test/org/apache/commons/collections/set/TestPredicatedSet.java
+++ b/src/test/org/apache/commons/collections/set/TestPredicatedSet.java
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -23,101 +23,103 @@ import junit.framework.Test;
 import junit.framework.TestSuite;
 
 import org.apache.commons.collections.Predicate;
-import org.apache.commons.collections.PredicateUtils;
+import org.apache.commons.collections.functors.TruePredicate;
 
 /**
- * Extension of {@link TestSet} for exercising the 
+ * Extension of {@link TestSet} for exercising the
  * {@link PredicatedSet} implementation.
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Phil Steitz
  */
-public class TestPredicatedSet extends AbstractTestSet{
-    
+public class TestPredicatedSet<E> extends AbstractTestSet<E> {
+
     public TestPredicatedSet(String testName) {
         super(testName);
     }
-    
+
     public static Test suite() {
         return new TestSuite(TestPredicatedSet.class);
     }
-    
+
     public static void main(String args[]) {
         String[] testCaseName = { TestPredicatedSet.class.getName()};
         junit.textui.TestRunner.main(testCaseName);
     }
-    
+
  //-------------------------------------------------------------------
-    
-    protected Predicate truePredicate = PredicateUtils.truePredicate();
-    
-    protected Set decorateSet(Set set, Predicate predicate) {
-        return PredicatedSet.decorate(set, predicate);
+
+    protected Predicate<E> truePredicate = TruePredicate.<E>truePredicate();
+
+    protected PredicatedSet<E> decorateSet(Set<E> set, Predicate<? super E> 
predicate) {
+        return (PredicatedSet<E>) PredicatedSet.decorate(set, predicate);
     }
-    
-    public Set makeEmptySet() {
-        return decorateSet(new HashSet(), truePredicate);
+
+    public PredicatedSet<E> makeObject() {
+        return decorateSet(new HashSet<E>(), truePredicate);
     }
-    
-    public Object[] getFullElements() {
-        return new Object[] {"1", "3", "5", "7", "2", "4", "6"};
+
+    @SuppressWarnings("unchecked")
+    public E[] getFullElements() {
+        return (E[]) new Object[] {"1", "3", "5", "7", "2", "4", "6"};
     }
-    
-//--------------------------------------------------------------------   
-    
-    protected Predicate testPredicate =  
-        new Predicate() {
-            public boolean evaluate(Object o) {
+
+//--------------------------------------------------------------------
+
+    protected Predicate<E> testPredicate =
+        new Predicate<E>() {
+            public boolean evaluate(E o) {
                 return o instanceof String;
             }
-        };      
-    
-    protected Set makeTestSet() {
-        return decorateSet(new HashSet(), testPredicate);
+        };
+
+    protected PredicatedSet<E> makeTestSet() {
+        return decorateSet(new HashSet<E>(), testPredicate);
     }
-    
+
     public void testGetSet() {
-         Set set = makeTestSet();
-        assertTrue("returned set should not be null",
-            ((PredicatedSet) set).decorated() != null);
+        PredicatedSet<E> set = makeTestSet();
+        assertTrue("returned set should not be null", set.decorated() != null);
     }
-    
+
+    @SuppressWarnings("unchecked")
     public void testIllegalAdd() {
-        Set set = makeTestSet();
+        Set<E> set = makeTestSet();
         Integer i = new Integer(3);
         try {
-            set.add(i);
+            set.add((E) i);
             fail("Integer should fail string predicate.");
         } catch (IllegalArgumentException e) {
             // expected
         }
-        assertTrue("Collection shouldn't contain illegal element", 
-         !set.contains(i));   
+        assertTrue("Collection shouldn't contain illegal element",
+         !set.contains(i));
     }
 
+    @SuppressWarnings("unchecked")
     public void testIllegalAddAll() {
-        Set set = makeTestSet();
-        Set elements = new HashSet();
-        elements.add("one");
-        elements.add("two");
-        elements.add(new Integer(3));
-        elements.add("four");
+        Set<E> set = makeTestSet();
+        Set<E> elements = new HashSet<E>();
+        elements.add((E) "one");
+        elements.add((E) "two");
+        elements.add((E) new Integer(3));
+        elements.add((E) "four");
         try {
             set.addAll(elements);
             fail("Integer should fail string predicate.");
         } catch (IllegalArgumentException e) {
             // expected
         }
-        assertTrue("Set shouldn't contain illegal element", 
-         !set.contains("one"));   
-        assertTrue("Set shouldn't contain illegal element", 
-         !set.contains("two"));   
-        assertTrue("Set shouldn't contain illegal element", 
-         !set.contains(new Integer(3)));   
-        assertTrue("Set shouldn't contain illegal element", 
-         !set.contains("four"));   
+        assertTrue("Set shouldn't contain illegal element",
+         !set.contains("one"));
+        assertTrue("Set shouldn't contain illegal element",
+         !set.contains("two"));
+        assertTrue("Set shouldn't contain illegal element",
+         !set.contains(new Integer(3)));
+        assertTrue("Set shouldn't contain illegal element",
+         !set.contains("four"));
     }
 
     public String getCompatibilityVersion() {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/set/TestPredicatedSortedSet.java
----------------------------------------------------------------------
diff --git 
a/src/test/org/apache/commons/collections/set/TestPredicatedSortedSet.java 
b/src/test/org/apache/commons/collections/set/TestPredicatedSortedSet.java
index 508abba..b225c29 100644
--- a/src/test/org/apache/commons/collections/set/TestPredicatedSortedSet.java
+++ b/src/test/org/apache/commons/collections/set/TestPredicatedSortedSet.java
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -26,106 +26,101 @@ import junit.framework.Test;
 
 import org.apache.commons.collections.BulkTest;
 import org.apache.commons.collections.Predicate;
-import org.apache.commons.collections.PredicateUtils;
+import org.apache.commons.collections.functors.TruePredicate;
 import org.apache.commons.collections.map.TestPredicatedSortedMap;
 
 /**
- * Extension of {@link AbstractTestSortedSet} for exercising the 
+ * Extension of {@link AbstractTestSortedSet} for exercising the
  * {@link PredicatedSortedSet} implementation.
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Phil Steitz
  */
-public class TestPredicatedSortedSet extends AbstractTestSortedSet{
-    
+public class TestPredicatedSortedSet<E> extends AbstractTestSortedSet<E> {
+
     public TestPredicatedSortedSet(String testName) {
         super(testName);
     }
-    
+
     public static Test suite() {
         return BulkTest.makeSuite(TestPredicatedSortedSet.class);
     }
-    
+
     public static void main(String args[]) {
         String[] testCaseName = { TestPredicatedSortedMap.class.getName()};
         junit.textui.TestRunner.main(testCaseName);
     }
-    
- //-------------------------------------------------------------------    
-    
-    protected Predicate truePredicate = PredicateUtils.truePredicate();
-    
-    public Set makeEmptySet() {
-        return PredicatedSortedSet.decorate(new TreeSet(), truePredicate);
+
+ //-------------------------------------------------------------------
+
+    protected Predicate<E> truePredicate = TruePredicate.<E>truePredicate();
+
+    public SortedSet<E> makeObject() {
+        return PredicatedSortedSet.decorate(new TreeSet<E>(), truePredicate);
     }
-    
-    public Set makeFullSet() {
-        TreeSet set = new TreeSet();
+
+    public SortedSet<E> makeFullCollection() {
+        TreeSet<E> set = new TreeSet<E>();
         set.addAll(Arrays.asList(getFullElements()));
         return PredicatedSortedSet.decorate(set, truePredicate);
     }
-   
-    
-//--------------------------------------------------------------------   
-    protected Predicate testPredicate =  
-        new Predicate() {
-            public boolean evaluate(Object o) {
+
+//--------------------------------------------------------------------
+    protected Predicate<E> testPredicate =
+        new Predicate<E>() {
+            public boolean evaluate(E o) {
                 return (o instanceof String) && (((String) o).startsWith("A"));
             }
-        };      
-     
-    
-    protected SortedSet makeTestSet() {
-        return PredicatedSortedSet.decorate(new TreeSet(), testPredicate);
+        };
+
+    protected PredicatedSortedSet<E> makeTestSet() {
+        return (PredicatedSortedSet<E>) PredicatedSortedSet.decorate(new 
TreeSet<E>(), testPredicate);
     }
-    
+
     public void testGetSet() {
-        SortedSet set = makeTestSet();
-        assertTrue("returned set should not be null",
-            ((PredicatedSortedSet) set).decorated() != null);
+        PredicatedSortedSet<E> set = makeTestSet();
+        assertTrue("returned set should not be null", set.decorated() != null);
     }
-    
+
+    @SuppressWarnings("unchecked")
     public void testIllegalAdd() {
-        SortedSet set = makeTestSet();
+        SortedSet<E> set = makeTestSet();
         String testString = "B";
         try {
-            set.add(testString);
+            set.add((E) testString);
             fail("Should fail string predicate.");
         } catch (IllegalArgumentException e) {
             // expected
         }
-        assertTrue("Collection shouldn't contain illegal element", 
-         !set.contains(testString));   
+        assertTrue("Collection shouldn't contain illegal element",
+         !set.contains(testString));
     }
 
+    @SuppressWarnings("unchecked")
     public void testIllegalAddAll() {
-        SortedSet set = makeTestSet();
-        Set elements = new TreeSet();
-        elements.add("Aone");
-        elements.add("Atwo");
-        elements.add("Bthree");
-        elements.add("Afour");
+        SortedSet<E> set = makeTestSet();
+        Set<E> elements = new TreeSet<E>();
+        elements.add((E) "Aone");
+        elements.add((E) "Atwo");
+        elements.add((E) "Bthree");
+        elements.add((E) "Afour");
         try {
             set.addAll(elements);
             fail("Should fail string predicate.");
         } catch (IllegalArgumentException e) {
             // expected
         }
-        assertTrue("Set shouldn't contain illegal element", 
-         !set.contains("Aone"));   
-        assertTrue("Set shouldn't contain illegal element", 
-         !set.contains("Atwo"));   
-        assertTrue("Set shouldn't contain illegal element", 
-         !set.contains("Bthree"));   
-        assertTrue("Set shouldn't contain illegal element", 
-         !set.contains("Afour"));   
+        assertTrue("Set shouldn't contain illegal element", 
!set.contains("Aone"));
+        assertTrue("Set shouldn't contain illegal element", 
!set.contains("Atwo"));
+        assertTrue("Set shouldn't contain illegal element", 
!set.contains("Bthree"));
+        assertTrue("Set shouldn't contain illegal element", 
!set.contains("Afour"));
     }
-    
+
     public void testComparator() {
-        SortedSet set = makeTestSet();
-        Comparator c = set.comparator();
+        SortedSet<E> set = makeTestSet();
+        Comparator<? super E> c = set.comparator();
         assertTrue("natural order, so comparator should be null", c == null);
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/set/TestSynchronizedSet.java
----------------------------------------------------------------------
diff --git 
a/src/test/org/apache/commons/collections/set/TestSynchronizedSet.java 
b/src/test/org/apache/commons/collections/set/TestSynchronizedSet.java
index 43b9fff..98dc26b 100644
--- a/src/test/org/apache/commons/collections/set/TestSynchronizedSet.java
+++ b/src/test/org/apache/commons/collections/set/TestSynchronizedSet.java
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -24,32 +24,32 @@ import junit.framework.Test;
 import org.apache.commons.collections.BulkTest;
 
 /**
- * Extension of {@link AbstractTestSet} for exercising the 
+ * Extension of {@link AbstractTestSet} for exercising the
  * {@link SynchronizedSet} implementation.
  *
  * @since Commons Collections 3.1
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
-public class TestSynchronizedSet extends AbstractTestSet{
-    
+public class TestSynchronizedSet<E> extends AbstractTestSet<E> {
+
     public TestSynchronizedSet(String testName) {
         super(testName);
     }
-    
+
     public static Test suite() {
         return BulkTest.makeSuite(TestSynchronizedSet.class);
     }
-    
+
     public static void main(String args[]) {
         String[] testCaseName = { TestSynchronizedSet.class.getName()};
         junit.textui.TestRunner.main(testCaseName);
     }
-    
-   //-------------------------------------------------------------------      
-    public Set makeEmptySet() {
-        return SynchronizedSet.decorate(new HashSet());
+
+   //-------------------------------------------------------------------
+    public Set<E> makeObject() {
+        return SynchronizedSet.decorate(new HashSet<E>());
     }
 
     public String getCompatibilityVersion() {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/set/TestSynchronizedSortedSet.java
----------------------------------------------------------------------
diff --git 
a/src/test/org/apache/commons/collections/set/TestSynchronizedSortedSet.java 
b/src/test/org/apache/commons/collections/set/TestSynchronizedSortedSet.java
index ace8d9d..282b0dd 100644
--- a/src/test/org/apache/commons/collections/set/TestSynchronizedSortedSet.java
+++ b/src/test/org/apache/commons/collections/set/TestSynchronizedSortedSet.java
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -16,7 +16,7 @@
  */
 package org.apache.commons.collections.set;
 
-import java.util.Set;
+import java.util.SortedSet;
 import java.util.TreeSet;
 
 import junit.framework.Test;
@@ -24,32 +24,32 @@ import junit.framework.Test;
 import org.apache.commons.collections.BulkTest;
 
 /**
- * Extension of {@link AbstractTestSet} for exercising the 
+ * Extension of {@link AbstractTestSet} for exercising the
  * {@link SynchronizedSortedSet} implementation.
  *
  * @since Commons Collections 3.1
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
-public class TestSynchronizedSortedSet extends AbstractTestSortedSet{
-    
+public class TestSynchronizedSortedSet<E> extends AbstractTestSortedSet<E> {
+
     public TestSynchronizedSortedSet(String testName) {
         super(testName);
     }
-    
+
     public static Test suite() {
         return BulkTest.makeSuite(TestSynchronizedSortedSet.class);
     }
-    
+
     public static void main(String args[]) {
         String[] testCaseName = { TestSynchronizedSortedSet.class.getName()};
         junit.textui.TestRunner.main(testCaseName);
     }
-    
-   //-------------------------------------------------------------------      
-    public Set makeEmptySet() {
-        return SynchronizedSortedSet.decorate(new TreeSet());
+
+   //-------------------------------------------------------------------
+    public SortedSet<E> makeObject() {
+        return SynchronizedSortedSet.decorate(new TreeSet<E>());
     }
 
     public String getCompatibilityVersion() {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/set/TestTransformedSet.java
----------------------------------------------------------------------
diff --git 
a/src/test/org/apache/commons/collections/set/TestTransformedSet.java 
b/src/test/org/apache/commons/collections/set/TestTransformedSet.java
index 825c6e5..77855d8 100644
--- a/src/test/org/apache/commons/collections/set/TestTransformedSet.java
+++ b/src/test/org/apache/commons/collections/set/TestTransformedSet.java
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,13 +17,13 @@
 package org.apache.commons.collections.set;
 
 import java.util.Arrays;
-import java.util.Collection;
 import java.util.HashSet;
 import java.util.Set;
 
 import junit.framework.Test;
 import junit.framework.TestSuite;
 
+import org.apache.commons.collections.Transformer;
 import org.apache.commons.collections.collection.TestTransformedCollection;
 
 /**
@@ -32,11 +32,11 @@ import 
org.apache.commons.collections.collection.TestTransformedCollection;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
-public class TestTransformedSet extends AbstractTestSet {
-    
+public class TestTransformedSet<E> extends AbstractTestSet<E> {
+
     public TestTransformedSet(String testName) {
         super(testName);
     }
@@ -50,40 +50,46 @@ public class TestTransformedSet extends AbstractTestSet {
         junit.textui.TestRunner.main(testCaseName);
     }
 
-    public Collection makeConfirmedCollection() {
-        return new HashSet();
+    public Set<E> makeConfirmedCollection() {
+        return new HashSet<E>();
     }
 
-    public Collection makeConfirmedFullCollection() {
-        Set set = new HashSet();
+    public Set<E> makeConfirmedFullCollection() {
+        Set<E> set = new HashSet<E>();
         set.addAll(Arrays.asList(getFullElements()));
         return set;
     }
-    
-    public Set makeEmptySet() {
-        return TransformedSet.decorate(new HashSet(), 
TestTransformedCollection.NOOP_TRANSFORMER);
+
+    @SuppressWarnings("unchecked")
+    public Set<E> makeObject() {
+        return TransformedSet.decorate(new HashSet<E>(),
+                (Transformer<E, E>) 
TestTransformedCollection.NOOP_TRANSFORMER);
     }
 
-    public Set makeFullSet() {
-        Set list = new HashSet();
+    @SuppressWarnings("unchecked")
+    public Set<E> makeFullCollection() {
+        Set<E> list = new HashSet<E>();
         list.addAll(Arrays.asList(getFullElements()));
-        return TransformedSet.decorate(list, 
TestTransformedCollection.NOOP_TRANSFORMER);
+        return TransformedSet.decorate(list,
+                (Transformer<E, E>) 
TestTransformedCollection.NOOP_TRANSFORMER);
     }
-    
+
+    @SuppressWarnings("unchecked")
     public void testTransformedSet() {
-        Set set = TransformedSet.decorate(new HashSet(), 
TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER);
+        Set<E> set = TransformedSet.decorate(new HashSet<E>(),
+                (Transformer<E, E>) 
TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER);
         assertEquals(0, set.size());
-        Object[] els = new Object[] {"1", "3", "5", "7", "2", "4", "6"};
+        E[] els = (E[]) new Object[] { "1", "3", "5", "7", "2", "4", "6" };
         for (int i = 0; i < els.length; i++) {
             set.add(els[i]);
             assertEquals(i + 1, set.size());
             assertEquals(true, set.contains(new Integer((String) els[i])));
             assertEquals(false, set.contains(els[i]));
         }
-        
+
         assertEquals(false, set.remove(els[0]));
         assertEquals(true, set.remove(new Integer((String) els[0])));
-        
+
     }
 
     public String getCompatibilityVersion() {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/set/TestTransformedSortedSet.java
----------------------------------------------------------------------
diff --git 
a/src/test/org/apache/commons/collections/set/TestTransformedSortedSet.java 
b/src/test/org/apache/commons/collections/set/TestTransformedSortedSet.java
index 82e33f9..9bf1e0d 100644
--- a/src/test/org/apache/commons/collections/set/TestTransformedSortedSet.java
+++ b/src/test/org/apache/commons/collections/set/TestTransformedSortedSet.java
@@ -17,14 +17,13 @@
 package org.apache.commons.collections.set;
 
 import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
 import java.util.SortedSet;
 import java.util.TreeSet;
 
 import junit.framework.Test;
 
 import org.apache.commons.collections.BulkTest;
+import org.apache.commons.collections.Transformer;
 import org.apache.commons.collections.collection.TestTransformedCollection;
 
 /**
@@ -33,11 +32,11 @@ import 
org.apache.commons.collections.collection.TestTransformedCollection;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
-public class TestTransformedSortedSet extends AbstractTestSortedSet {
-    
+public class TestTransformedSortedSet<E> extends AbstractTestSortedSet<E> {
+
     public TestTransformedSortedSet(String testName) {
         super(testName);
     }
@@ -52,32 +51,35 @@ public class TestTransformedSortedSet extends 
AbstractTestSortedSet {
     }
 
     //-----------------------------------------------------------------------
-    public Set makeEmptySet() {
-        return TransformedSortedSet.decorate(new TreeSet(), 
TestTransformedCollection.NOOP_TRANSFORMER);
+    @SuppressWarnings("unchecked")
+    public SortedSet<E> makeObject() {
+        return TransformedSortedSet.decorate(new TreeSet<E>(), (Transformer<E, 
E>) TestTransformedCollection.NOOP_TRANSFORMER);
     }
 
-    public Set makeFullSet() {
-        SortedSet set = new TreeSet();
+    @SuppressWarnings("unchecked")
+    public SortedSet<E> makeFullCollection() {
+        SortedSet<E> set = new TreeSet<E>();
         set.addAll(Arrays.asList(getFullElements()));
-        return TransformedSortedSet.decorate(set, 
TestTransformedCollection.NOOP_TRANSFORMER);
+        return TransformedSortedSet.decorate(set, (Transformer<E, E>) 
TestTransformedCollection.NOOP_TRANSFORMER);
     }
-    
-    //-----------------------------------------------------------------------  
 
+
+    //-----------------------------------------------------------------------
+    @SuppressWarnings("unchecked")
     public void testTransformedSet() {
-        Set set = TransformedSortedSet.decorate(new HashSet(), 
TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER);
+        SortedSet<E> set = TransformedSortedSet.decorate(new TreeSet<E>(),
+                (Transformer<E, E>) 
TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER);
         assertEquals(0, set.size());
-        Object[] els = new Object[] {"1", "3", "5", "7", "2", "4", "6"};
+        E[] els = (E[]) new Object[] { "1", "3", "5", "7", "2", "4", "6" };
         for (int i = 0; i < els.length; i++) {
             set.add(els[i]);
             assertEquals(i + 1, set.size());
             assertEquals(true, set.contains(new Integer((String) els[i])));
-            assertEquals(false, set.contains(els[i]));
+            assertNotCollectionContains(set, els[i]);
         }
-        
-        assertEquals(false, set.remove(els[0]));
+
+        assertNotRemoveFromCollection(set, els[0]);
         assertEquals(true, set.remove(new Integer((String) els[0])));
-        
-    } 
+    }
 
     public String getCompatibilityVersion() {
         return "3.1";

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/set/TestUnmodifiableSet.java
----------------------------------------------------------------------
diff --git 
a/src/test/org/apache/commons/collections/set/TestUnmodifiableSet.java 
b/src/test/org/apache/commons/collections/set/TestUnmodifiableSet.java
index cd800cb..3ab6185 100644
--- a/src/test/org/apache/commons/collections/set/TestUnmodifiableSet.java
+++ b/src/test/org/apache/commons/collections/set/TestUnmodifiableSet.java
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -25,44 +25,44 @@ import junit.framework.Test;
 import org.apache.commons.collections.BulkTest;
 
 /**
- * Extension of {@link AbstractTestSet} for exercising the 
+ * Extension of {@link AbstractTestSet} for exercising the
  * {@link UnmodifiableSet} implementation.
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Phil Steitz
  */
-public class TestUnmodifiableSet extends AbstractTestSet{
-    
+public class TestUnmodifiableSet<E> extends AbstractTestSet<E> {
+
     public TestUnmodifiableSet(String testName) {
         super(testName);
     }
-    
+
     public static Test suite() {
         return BulkTest.makeSuite(TestUnmodifiableSet.class);
     }
-    
+
     public static void main(String args[]) {
         String[] testCaseName = { TestUnmodifiableSet.class.getName()};
         junit.textui.TestRunner.main(testCaseName);
     }
-    
-    //-------------------------------------------------------------------  
-    public Set makeEmptySet() {
-        return UnmodifiableSet.decorate(new HashSet());
+
+    //-------------------------------------------------------------------
+    public Set<E> makeObject() {
+        return UnmodifiableSet.decorate(new HashSet<E>());
     }
-    
-    public Set makeFullSet() {
-        HashSet set = new HashSet();
+
+    public Set<E> makeFullCollection() {
+        HashSet<E> set = new HashSet<E>();
         set.addAll(Arrays.asList(getFullElements()));
         return UnmodifiableSet.decorate(set);
     }
-    
+
     public boolean isAddSupported() {
         return false;
     }
-    
+
     public boolean isRemoveSupported() {
         return false;
     }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/set/TestUnmodifiableSortedSet.java
----------------------------------------------------------------------
diff --git 
a/src/test/org/apache/commons/collections/set/TestUnmodifiableSortedSet.java 
b/src/test/org/apache/commons/collections/set/TestUnmodifiableSortedSet.java
index 8758f58..174d4f3 100644
--- a/src/test/org/apache/commons/collections/set/TestUnmodifiableSortedSet.java
+++ b/src/test/org/apache/commons/collections/set/TestUnmodifiableSortedSet.java
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,6 +20,7 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Comparator;
 import java.util.Set;
+import java.util.SortedSet;
 import java.util.TreeSet;
 
 import junit.framework.Test;
@@ -27,81 +28,83 @@ import junit.framework.Test;
 import org.apache.commons.collections.BulkTest;
 
 /**
- * Extension of {@link AbstractTestSortedSet} for exercising the 
+ * Extension of {@link AbstractTestSortedSet} for exercising the
  * {@link UnmodifiableSortedSet} implementation.
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Phil Steitz
  */
-public class TestUnmodifiableSortedSet extends AbstractTestSortedSet{
-    
+public class TestUnmodifiableSortedSet<E> extends AbstractTestSortedSet<E> {
+    protected UnmodifiableSortedSet<E> set = null;
+    protected ArrayList<E> array = null;
+
     public TestUnmodifiableSortedSet(String testName) {
         super(testName);
     }
-    
+
     public static Test suite() {
         return BulkTest.makeSuite(TestUnmodifiableSortedSet.class);
     }
-    
+
     public static void main(String args[]) {
         String[] testCaseName = { TestUnmodifiableSortedSet.class.getName()};
         junit.textui.TestRunner.main(testCaseName);
     }
-    
-    //-------------------------------------------------------------------  
-    public Set makeEmptySet() {
-        return UnmodifiableSortedSet.decorate(new TreeSet());
+
+    //-------------------------------------------------------------------
+    public SortedSet<E> makeObject() {
+        return UnmodifiableSortedSet.decorate(new TreeSet<E>());
     }
-    
-    public Set makeFullSet() {
-        TreeSet set = new TreeSet();
+
+    public UnmodifiableSortedSet<E> makeFullCollection() {
+        TreeSet<E> set = new TreeSet<E>();
         set.addAll(Arrays.asList(getFullElements()));
-        return UnmodifiableSortedSet.decorate(set);
+        return (UnmodifiableSortedSet<E>) UnmodifiableSortedSet.decorate(set);
     }
-    
+
     public boolean isAddSupported() {
         return false;
     }
-    
+
     public boolean isRemoveSupported() {
         return false;
     }
-           
+
     //--------------------------------------------------------------------
-    protected UnmodifiableSortedSet set = null;
-    protected ArrayList array = null;
-    
+    @SuppressWarnings("unchecked")
     protected void setupSet() {
-        set = (UnmodifiableSortedSet) makeFullSet();
-        array = new ArrayList();
-        array.add(new Integer(1));
+        set = makeFullCollection();
+        array = new ArrayList<E>();
+        array.add((E) new Integer(1));
     }
-    
-    /** 
+
+    /**
      * Verify that base set and subsets are not modifiable
      */
+    @SuppressWarnings("unchecked")
     public void testUnmodifiable() {
         setupSet();
         verifyUnmodifiable(set);
-        verifyUnmodifiable(set.headSet(new Integer(1)));
-        verifyUnmodifiable(set.tailSet(new Integer(1)));
-        verifyUnmodifiable(set.subSet(new Integer(1), new Integer(3)));    
+        verifyUnmodifiable(set.headSet((E) new Integer(1)));
+        verifyUnmodifiable(set.tailSet((E) new Integer(1)));
+        verifyUnmodifiable(set.subSet((E) new Integer(1), (E) new Integer(3)));
     }
-    
+
     /**
      * Verifies that a set is not modifiable
      */
-    public void verifyUnmodifiable(Set set) {
+    @SuppressWarnings("unchecked")
+    public void verifyUnmodifiable(Set<E> set) {
         try {
-            set.add("value");
+            set.add((E) "value");
             fail("Expecting UnsupportedOperationException.");
         } catch (UnsupportedOperationException e) {
-            // expected  
+            // expected
         }
         try {
-            set.addAll(new TreeSet());
+            set.addAll(new TreeSet<E>());
             fail("Expecting UnsupportedOperationException.");
         } catch (UnsupportedOperationException e) {
             // expected
@@ -131,10 +134,10 @@ public class TestUnmodifiableSortedSet extends 
AbstractTestSortedSet{
             // expected
         }
     }
-    
+
     public void testComparator() {
         setupSet();
-        Comparator c = set.comparator();
+        Comparator<? super E> c = set.comparator();
         assertTrue("natural order, so comparator should be null", c == null);
     }
 

Reply via email to