You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2012/06/24 03:34:57 UTC
svn commit: r1353221 - in
/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections:
TestExtendedProperties.java list/TestSetUniqueList.java
list/TestTransformedList.java
Author: sebb
Date: Sun Jun 24 01:34:56 2012
New Revision: 1353221
URL: http://svn.apache.org/viewvc?rev=1353221&view=rev
Log:
Generics
Modified:
commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/TestExtendedProperties.java
commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/list/TestSetUniqueList.java
commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/list/TestTransformedList.java
Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/TestExtendedProperties.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/TestExtendedProperties.java?rev=1353221&r1=1353220&r2=1353221&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/TestExtendedProperties.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/TestExtendedProperties.java Sun Jun 24 01:34:56 2012
@@ -326,10 +326,10 @@ public class TestExtendedProperties exte
p.addProperty("b", "bar");
p.addProperty("c", "bar");
- Iterator it = p.getKeys();
- assertEquals("a", (String) it.next());
- assertEquals("b", (String) it.next());
- assertEquals("c", (String) it.next());
+ Iterator<String> it = p.getKeys();
+ assertEquals("a", it.next());
+ assertEquals("b", it.next());
+ assertEquals("c", it.next());
assertFalse(it.hasNext());
}
@@ -339,10 +339,10 @@ public class TestExtendedProperties exte
p.put("b", "bar");
p.put("c", "bar");
- Iterator it = p.getKeys();
- assertEquals("a", (String) it.next());
- assertEquals("b", (String) it.next());
- assertEquals("c", (String) it.next());
+ Iterator<String> it = p.getKeys();
+ assertEquals("a", it.next());
+ assertEquals("b", it.next());
+ assertEquals("c", it.next());
assertFalse(it.hasNext());
}
@@ -356,10 +356,10 @@ public class TestExtendedProperties exte
ExtendedProperties p = new ExtendedProperties();
p.putAll(q);
- Iterator it = p.getKeys();
- assertEquals("a", (String) it.next());
- assertEquals("b", (String) it.next());
- assertEquals("c", (String) it.next());
+ Iterator<String> it = p.getKeys();
+ assertEquals("a", it.next());
+ assertEquals("b", it.next());
+ assertEquals("c", it.next());
assertFalse(it.hasNext());
}
@@ -371,9 +371,9 @@ public class TestExtendedProperties exte
q.remove("b");
- Iterator it = q.getKeys();
- assertEquals("a", (String) it.next());
- assertEquals("c", (String) it.next());
+ Iterator<String> it = q.getKeys();
+ assertEquals("a", it.next());
+ assertEquals("c", it.next());
assertFalse(it.hasNext());
}
Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/list/TestSetUniqueList.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/list/TestSetUniqueList.java?rev=1353221&r1=1353220&r2=1353221&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/list/TestSetUniqueList.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/list/TestSetUniqueList.java Sun Jun 24 01:34:56 2012
@@ -141,17 +141,16 @@ public class TestSetUniqueList<E> extend
size + elements.length, getCollection().size());
}
- // TODO: Generics
public void testIntCollectionAddAll() {
// make a SetUniqueList with one element
- List list = new SetUniqueList(new ArrayList(), new HashSet());
+ List<Integer> list = new SetUniqueList<Integer>(new ArrayList<Integer>(), new HashSet<Integer>());
final Integer existingElement = new Integer(1);
list.add(existingElement);
// add two new unique elements at index 0
final Integer firstNewElement = new Integer(2);
final Integer secondNewElement = new Integer(3);
- Collection collection = Arrays.asList(new Integer[] {firstNewElement, secondNewElement});
+ Collection<Integer> collection = Arrays.asList(new Integer[] {firstNewElement, secondNewElement});
list.addAll(0, collection);
assertEquals("Unique elements should be added.", 3, list.size());
assertEquals("First new element should be at index 0", firstNewElement, list.get(0));
@@ -457,8 +456,8 @@ public class TestSetUniqueList<E> extend
// TODO: Generics
public void testCollections304() {
- List list = new LinkedList();
- SetUniqueList decoratedList = SetUniqueList.setUniqueList(list);
+ List<String> list = new LinkedList<String>();
+ SetUniqueList<String> decoratedList = SetUniqueList.setUniqueList(list);
String s1 = "Apple";
String s2 = "Lemon";
String s3 = "Orange";
Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/list/TestTransformedList.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/list/TestTransformedList.java?rev=1353221&r1=1353220&r2=1353221&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/list/TestTransformedList.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/list/TestTransformedList.java Sun Jun 24 01:34:56 2012
@@ -114,12 +114,12 @@ public class TestTransformedList<E> exte
}
public void testTransformedList_decorateTransform() {
- List originalList = new ArrayList();
+ List<Object> originalList = new ArrayList<Object>();
Object[] els = new Object[] {"1", "3", "5", "7", "2", "4", "6"};
for (int i = 0; i < els.length; i++) {
originalList.add(els[i]);
}
- List list = TransformedList.transformedList(originalList, TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER);
+ List<?> list = TransformedList.transformedList(originalList, TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER);
assertEquals(els.length, list.size());
for (int i = 0; i < els.length; i++) {
assertEquals(true, list.contains(new Integer((String) els[i])));