git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/trunk@1353221 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sebastian Bazley 2012-06-24 01:34:56 +00:00
parent 6e8a14adda
commit 2de4064e0e
3 changed files with 21 additions and 22 deletions

View File

@ -326,10 +326,10 @@ public class TestExtendedProperties extends TestCase {
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 extends TestCase {
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 extends TestCase {
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 extends TestCase {
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());
}

View File

@ -141,17 +141,16 @@ public class TestSetUniqueList<E> extends AbstractTestList<E> {
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> extends AbstractTestList<E> {
// 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";

View File

@ -114,12 +114,12 @@ public class TestTransformedList<E> extends AbstractTestList<E> {
}
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])));