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 2011/10/22 03:28:09 UTC
svn commit: r1187626 - in
/commons/proper/functor/trunk/src/test/java/org/apache/commons/functor:
core/composite/TestUnarySequence.java generator/util/TestEachElement.java
Author: sebb
Date: Sat Oct 22 01:28:09 2011
New Revision: 1187626
URL: http://svn.apache.org/viewvc?rev=1187626&view=rev
Log:
Raw types
Modified:
commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestUnarySequence.java
commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/generator/util/TestEachElement.java
Modified: commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestUnarySequence.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestUnarySequence.java?rev=1187626&r1=1187625&r2=1187626&view=diff
==============================================================================
--- commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestUnarySequence.java (original)
+++ commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestUnarySequence.java Sat Oct 22 01:28:09 2011
@@ -38,7 +38,7 @@ public class TestUnarySequence extends B
@Override
protected Object makeFunctor() {
- return new UnarySequence(new NoOp(),new NoOp());
+ return new UnarySequence<Object>(new NoOp(),new NoOp());
}
// Tests
@@ -46,7 +46,7 @@ public class TestUnarySequence extends B
@Test
public void testRunZero() throws Exception {
- UnarySequence seq = new UnarySequence();
+ UnarySequence<String> seq = new UnarySequence<String>();
seq.run(null);
seq.run("xyzzy");
}
@@ -54,7 +54,7 @@ public class TestUnarySequence extends B
@Test
public void testRunOne() throws Exception {
RunCounter counter = new RunCounter();
- UnarySequence seq = new UnarySequence(counter);
+ UnarySequence<String> seq = new UnarySequence<String>(counter);
assertEquals(0,counter.count);
seq.run(null);
assertEquals(1,counter.count);
@@ -65,7 +65,7 @@ public class TestUnarySequence extends B
@Test
public void testRunTwo() throws Exception {
RunCounter[] counter = { new RunCounter(), new RunCounter() };
- UnarySequence seq = new UnarySequence(counter[0],counter[1]);
+ UnarySequence<String> seq = new UnarySequence<String>(counter[0],counter[1]);
assertEquals(0,counter[0].count);
assertEquals(0,counter[1].count);
seq.run(null);
@@ -78,8 +78,8 @@ public class TestUnarySequence extends B
@Test
public void testThen() throws Exception {
- List list = new ArrayList();
- UnarySequence seq = new UnarySequence();
+ List<RunCounter> list = new ArrayList<RunCounter>();
+ UnarySequence<String> seq = new UnarySequence<String>();
seq.run(null);
for (int i=0;i<10;i++) {
RunCounter counter = new RunCounter();
@@ -87,16 +87,16 @@ public class TestUnarySequence extends B
list.add(counter);
seq.run("xyzzy");
for (int j=0;j<list.size();j++) {
- assertEquals(list.size()-j,(((RunCounter)(list.get(j))).count));
+ assertEquals(list.size()-j,((list.get(j)).count));
}
}
}
@Test
public void testEquals() throws Exception {
- UnarySequence p = new UnarySequence();
+ UnarySequence<?> p = new UnarySequence<Object>();
assertEquals(p,p);
- UnarySequence q = new UnarySequence();
+ UnarySequence<?> q = new UnarySequence<Object>();
assertObjectsAreEqual(p,q);
for (int i=0;i<3;i++) {
@@ -104,9 +104,9 @@ public class TestUnarySequence extends B
assertObjectsAreNotEqual(p,q);
q.then(new NoOp());
assertObjectsAreEqual(p,q);
- p.then(new UnarySequence(new NoOp(),new NoOp()));
+ p.then(new UnarySequence<Object>(new NoOp(),new NoOp()));
assertObjectsAreNotEqual(p,q);
- q.then(new UnarySequence(new NoOp(),new NoOp()));
+ q.then(new UnarySequence<Object>(new NoOp(),new NoOp()));
assertObjectsAreEqual(p,q);
}
@@ -116,7 +116,7 @@ public class TestUnarySequence extends B
// Classes
// ------------------------------------------------------------------------
- static class RunCounter implements UnaryProcedure {
+ static class RunCounter implements UnaryProcedure<Object> {
public void run(Object that) {
count++;
}
Modified: commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/generator/util/TestEachElement.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/generator/util/TestEachElement.java?rev=1187626&r1=1187625&r2=1187626&view=diff
==============================================================================
--- commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/generator/util/TestEachElement.java (original)
+++ commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/generator/util/TestEachElement.java Sat Oct 22 01:28:09 2011
@@ -42,13 +42,13 @@ import org.junit.Test;
@SuppressWarnings("unchecked")
public class TestEachElement extends BaseFunctorTest {
- private List list = null;
- private Map map = null;
+ private List<Integer> list = null;
+ private Map<String, String> map = null;
private Object[] array = null;
@Override
protected Object makeFunctor() throws Exception {
- return EachElement.from(new ArrayList());
+ return EachElement.from(new ArrayList<Object>());
}
// Lifecycle
@@ -56,14 +56,14 @@ public class TestEachElement extends Bas
@Before
public void setUp() throws Exception {
- list = new ArrayList();
+ list = new ArrayList<Integer>();
list.add(new Integer(0));
list.add(new Integer(1));
list.add(new Integer(2));
list.add(new Integer(3));
list.add(new Integer(4));
- map = new HashMap();
+ map = new HashMap<String, String>();
map.put("1", "1-1");
map.put("2", "2-1");
map.put("3", "3-1");
@@ -83,22 +83,22 @@ public class TestEachElement extends Bas
@Test
public void testFromNull() {
- assertNull(EachElement.from((Collection) null));
- assertNull(EachElement.from((Map) null));
- assertNull(EachElement.from((Iterator) null));
+ assertNull(EachElement.from((Collection<?>) null));
+ assertNull(EachElement.from((Map<?, ?>) null));
+ assertNull(EachElement.from((Iterator<?>) null));
assertNull(EachElement.from((Object[]) null));
}
@Test
public void testWithList() {
- Collection col = EachElement.from(list).toCollection();
+ Collection<?> col = EachElement.from(list).toCollection();
assertEquals("[0, 1, 2, 3, 4]", col.toString());
}
@Test
public void testWithMap() {
- List col = (List) EachElement.from(map).toCollection();
+ List<?> col = (List<?>) EachElement.from(map).toCollection();
int i = 0;
for (;i<col.size();i++) {
Map.Entry entry = (Map.Entry) col.get(i);
@@ -120,21 +120,21 @@ public class TestEachElement extends Bas
@Test
public void testWithArray() {
- Collection col = EachElement.from(array).toCollection();
+ Collection<?> col = EachElement.from(array).toCollection();
assertEquals("[1, 2, 3, 4, 5]", col.toString());
}
@Test
public void testWithStop() {
- assertEquals("[0, 1, 2]", new UntilGenerate(new Offset(3), EachElement.from(list)).toCollection().toString());
- assertEquals("[0, 1, 2, 3]", new GenerateUntil(EachElement.from(list), new Offset(3)).toCollection().toString());
- assertEquals("[0, 1, 2]", new WhileGenerate(new Limit(3), EachElement.from(list)).toCollection().toString());
- assertEquals("[0, 1, 2, 3]", new GenerateWhile(EachElement.from(list), new Limit(3)).toCollection().toString());
+ assertEquals("[0, 1, 2]", new UntilGenerate<Integer>(new Offset(3), EachElement.from(list)).toCollection().toString());
+ assertEquals("[0, 1, 2, 3]", new GenerateUntil<Integer>(EachElement.from(list), new Offset(3)).toCollection().toString());
+ assertEquals("[0, 1, 2]", new WhileGenerate<Integer>(new Limit(3), EachElement.from(list)).toCollection().toString());
+ assertEquals("[0, 1, 2, 3]", new GenerateWhile<Integer>(EachElement.from(list), new Limit(3)).toCollection().toString());
}
@Test
public void testWithIterator() {
- Collection col = EachElement.from(list.iterator()).toCollection();
+ Collection<?> col = EachElement.from(list.iterator()).toCollection();
assertEquals("[0, 1, 2, 3, 4]", col.toString());
}