You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ba...@apache.org on 2009/09/15 07:44:37 UTC
svn commit: r815006 [2/2] - in /commons/proper/collections/trunk/src:
java/org/apache/commons/collections/
test/org/apache/commons/collections/collection/
Modified: commons/proper/collections/trunk/src/test/org/apache/commons/collections/collection/TestTransformedCollection.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/org/apache/commons/collections/collection/TestTransformedCollection.java?rev=815006&r1=815005&r2=815006&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/org/apache/commons/collections/collection/TestTransformedCollection.java (original)
+++ commons/proper/collections/trunk/src/test/org/apache/commons/collections/collection/TestTransformedCollection.java Tue Sep 15 05:44:36 2009
@@ -36,16 +36,16 @@
*
* @author Stephen Colebourne
*/
-public class TestTransformedCollection extends AbstractTestCollection {
+public class TestTransformedCollection extends AbstractTestCollection<Object> {
- private static class StringToInteger implements Transformer {
+ private static class StringToInteger implements Transformer<Object, Object> {
public Object transform(Object input) {
return new Integer((String) input);
}
}
- public static final Transformer NOOP_TRANSFORMER = TransformerUtils.nopTransformer();
- public static final Transformer STRING_TO_INTEGER_TRANSFORMER = new StringToInteger();
+ public static final Transformer<Object, Object> NOOP_TRANSFORMER = TransformerUtils.nopTransformer();
+ public static final Transformer<Object, Object> STRING_TO_INTEGER_TRANSFORMER = new StringToInteger();
public TestTransformedCollection(String testName) {
super(testName);
@@ -61,22 +61,22 @@
}
//-----------------------------------------------------------------------
- public Collection makeConfirmedCollection() {
- return new ArrayList();
+ public Collection<Object> makeConfirmedCollection() {
+ return new ArrayList<Object>();
}
- public Collection makeConfirmedFullCollection() {
- List list = new ArrayList();
+ public Collection<Object> makeConfirmedFullCollection() {
+ List<Object> list = new ArrayList<Object>();
list.addAll(Arrays.asList(getFullElements()));
return list;
}
- public Collection makeCollection() {
- return TransformedCollection.decorate(new ArrayList(), NOOP_TRANSFORMER);
+ public Collection<Object> makeObject() {
+ return TransformedCollection.decorate(new ArrayList<Object>(), NOOP_TRANSFORMER);
}
- public Collection makeFullCollection() {
- List list = new ArrayList();
+ public Collection<Object> makeFullCollection() {
+ List<Object> list = new ArrayList<Object>();
list.addAll(Arrays.asList(getFullElements()));
return TransformedCollection.decorate(list, NOOP_TRANSFORMER);
}
@@ -92,7 +92,7 @@
//-----------------------------------------------------------------------
public void testTransformedCollection() {
- Collection coll = TransformedCollection.decorate(new ArrayList(), STRING_TO_INTEGER_TRANSFORMER);
+ Collection<Object> coll = TransformedCollection.decorate(new ArrayList<Object>(), STRING_TO_INTEGER_TRANSFORMER);
assertEquals(0, coll.size());
Object[] els = getFullElements();
for (int i = 0; i < els.length; i++) {
Modified: commons/proper/collections/trunk/src/test/org/apache/commons/collections/collection/TestUnmodifiableCollection.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/org/apache/commons/collections/collection/TestUnmodifiableCollection.java?rev=815006&r1=815005&r2=815006&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/org/apache/commons/collections/collection/TestUnmodifiableCollection.java (original)
+++ commons/proper/collections/trunk/src/test/org/apache/commons/collections/collection/TestUnmodifiableCollection.java Tue Sep 15 05:44:36 2009
@@ -25,7 +25,7 @@
import junit.framework.TestSuite;
/**
- * Extension of {@link AbstractTestCollection} for exercising the
+ * Extension of {@link AbstractTestCollection} for exercising the
* {@link UnmodifiableCollection} implementation.
*
* @since Commons Collections 3.0
@@ -34,39 +34,38 @@
* @author Phil Steitz
* @author Stephen Colebourne
*/
-public class TestUnmodifiableCollection extends AbstractTestCollection {
-
+public class TestUnmodifiableCollection<E> extends AbstractTestCollection<E> {
+
public TestUnmodifiableCollection(String testName) {
super(testName);
}
-
+
public static Test suite() {
return new TestSuite(TestUnmodifiableCollection.class);
}
-
+
public static void main(String args[]) {
String[] testCaseName = { TestUnmodifiableCollection.class.getName()};
junit.textui.TestRunner.main(testCaseName);
}
- //-----------------------------------------------------------------------
- public Collection makeCollection() {
- return UnmodifiableCollection.decorate(new ArrayList());
- }
-
- public Collection makeFullCollection() {
- List list = new ArrayList();
+ //-----------------------------------------------------------------------
+ public Collection<E> makeObject() {
+ return UnmodifiableCollection.decorate(new ArrayList<E>());
+ }
+
+ public Collection<E> makeFullCollection() {
+ List<E> list = new ArrayList<E>();
list.addAll(Arrays.asList(getFullElements()));
return UnmodifiableCollection.decorate(list);
}
-
- public Collection makeConfirmedCollection() {
- ArrayList list = new ArrayList();
- return list;
+
+ public Collection<E> makeConfirmedCollection() {
+ return new ArrayList<E>();
}
- public Collection makeConfirmedFullCollection() {
- ArrayList list = new ArrayList();
+ public Collection<E> makeConfirmedFullCollection() {
+ ArrayList<E> list = new ArrayList<E>();
list.addAll(Arrays.asList(getFullElements()));
return list;
}
@@ -74,7 +73,7 @@
public boolean isAddSupported() {
return false;
}
-
+
public boolean isRemoveSupported() {
return false;
}