You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mb...@apache.org on 2013/01/27 19:15:38 UTC
svn commit: r1439134 - in
/commons/proper/functor/branches/FUNCTOR-14-mm/core/src/test/java/org/apache/commons/functor/generator:
./ loop/
Author: mbenson
Date: Sun Jan 27 18:15:38 2013
New Revision: 1439134
URL: http://svn.apache.org/viewvc?rev=1439134&view=rev
Log:
file org/layout
Modified:
commons/proper/functor/branches/FUNCTOR-14-mm/core/src/test/java/org/apache/commons/functor/generator/TestBaseGenerator.java
commons/proper/functor/branches/FUNCTOR-14-mm/core/src/test/java/org/apache/commons/functor/generator/TestFilteredGenerator.java
commons/proper/functor/branches/FUNCTOR-14-mm/core/src/test/java/org/apache/commons/functor/generator/loop/TestGenerateUntil.java
commons/proper/functor/branches/FUNCTOR-14-mm/core/src/test/java/org/apache/commons/functor/generator/loop/TestGenerateWhile.java
commons/proper/functor/branches/FUNCTOR-14-mm/core/src/test/java/org/apache/commons/functor/generator/loop/TestIteratorToGeneratorAdapter.java
commons/proper/functor/branches/FUNCTOR-14-mm/core/src/test/java/org/apache/commons/functor/generator/loop/TestLoopGenerator.java
commons/proper/functor/branches/FUNCTOR-14-mm/core/src/test/java/org/apache/commons/functor/generator/loop/TestTransformedGenerator.java
commons/proper/functor/branches/FUNCTOR-14-mm/core/src/test/java/org/apache/commons/functor/generator/loop/TestUntilGenerate.java
commons/proper/functor/branches/FUNCTOR-14-mm/core/src/test/java/org/apache/commons/functor/generator/loop/TestWhileGenerate.java
Modified: commons/proper/functor/branches/FUNCTOR-14-mm/core/src/test/java/org/apache/commons/functor/generator/TestBaseGenerator.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/branches/FUNCTOR-14-mm/core/src/test/java/org/apache/commons/functor/generator/TestBaseGenerator.java?rev=1439134&r1=1439133&r2=1439134&view=diff
==============================================================================
--- commons/proper/functor/branches/FUNCTOR-14-mm/core/src/test/java/org/apache/commons/functor/generator/TestBaseGenerator.java (original)
+++ commons/proper/functor/branches/FUNCTOR-14-mm/core/src/test/java/org/apache/commons/functor/generator/TestBaseGenerator.java Sun Jan 27 18:15:38 2013
@@ -35,6 +35,36 @@ import org.junit.Test;
*/
@SuppressWarnings("unchecked")
public class TestBaseGenerator {
+ // Attributes
+ // ------------------------------------------------------------------------
+ private List<Integer> list = null;
+ private List<Integer> doubled = null;
+ private List<Integer> evens = null;
+ private List<Integer> listWithDuplicates = null;
+ @SuppressWarnings("unused")
+ private int sum = 0;
+// private UnaryPredicate equalsThree = LeftBoundPredicate.bind(IsEqual.instance(),new Integer(3));
+// private UnaryPredicate equalsTwentyThree = LeftBoundPredicate.bind(IsEqual.instance(),new Integer(23));
+// private UnaryPredicate isEven = new UnaryPredicate() {
+// public boolean test(Object obj) {
+// return ((Number) obj).intValue() % 2 == 0;
+// }
+// };
+// private UnaryPredicate isOdd = new UnaryPredicate() {
+// public boolean test(Object obj) {
+// return ((Number) obj).intValue() % 2 != 0;
+// }
+// };
+
+ // Classes
+ // ------------------------------------------------------------------------
+
+ static class Summer implements UnaryProcedure<Number> {
+ public void run(Number that) {
+ sum += (that).intValue();
+ }
+ public int sum = 0;
+ }
private Generator<Integer> simpleGenerator = null;
@@ -114,35 +144,4 @@ public class TestBaseGenerator {
assertSame(fillThis, col);
assertEquals("[0, 1, 2, 3, 4]", col.toString());
}
-
- // Attributes
- // ------------------------------------------------------------------------
- private List<Integer> list = null;
- private List<Integer> doubled = null;
- private List<Integer> evens = null;
- private List<Integer> listWithDuplicates = null;
- @SuppressWarnings("unused")
- private int sum = 0;
-// private UnaryPredicate equalsThree = LeftBoundPredicate.bind(IsEqual.instance(),new Integer(3));
-// private UnaryPredicate equalsTwentyThree = LeftBoundPredicate.bind(IsEqual.instance(),new Integer(23));
-// private UnaryPredicate isEven = new UnaryPredicate() {
-// public boolean test(Object obj) {
-// return ((Number) obj).intValue() % 2 == 0;
-// }
-// };
-// private UnaryPredicate isOdd = new UnaryPredicate() {
-// public boolean test(Object obj) {
-// return ((Number) obj).intValue() % 2 != 0;
-// }
-// };
-
- // Classes
- // ------------------------------------------------------------------------
-
- static class Summer implements UnaryProcedure<Number> {
- public void run(Number that) {
- sum += (that).intValue();
- }
- public int sum = 0;
- }
}
\ No newline at end of file
Modified: commons/proper/functor/branches/FUNCTOR-14-mm/core/src/test/java/org/apache/commons/functor/generator/TestFilteredGenerator.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/branches/FUNCTOR-14-mm/core/src/test/java/org/apache/commons/functor/generator/TestFilteredGenerator.java?rev=1439134&r1=1439133&r2=1439134&view=diff
==============================================================================
--- commons/proper/functor/branches/FUNCTOR-14-mm/core/src/test/java/org/apache/commons/functor/generator/TestFilteredGenerator.java (original)
+++ commons/proper/functor/branches/FUNCTOR-14-mm/core/src/test/java/org/apache/commons/functor/generator/TestFilteredGenerator.java Sun Jan 27 18:15:38 2013
@@ -34,8 +34,17 @@ import org.junit.Test;
* Tests the Filtered Generator class.
* @version $Revision$ $Date$
*/
-public class TestFilteredGenerator
-{
+public class TestFilteredGenerator {
+ // Attributes
+ // ------------------------------------------------------------------------
+ private Generator<Integer> wrappedGenerator = null;
+ private UnaryPredicate<Integer> isEven = new UnaryPredicate<Integer>() {
+ public boolean test( Integer obj ) {
+ return obj % 2 == 0;
+ }
+ };
+ private Generator<Integer> filteredGenerator = null;
+
@Before
public void setUp() throws Exception {
@@ -107,16 +116,4 @@ public class TestFilteredGenerator
List<Integer> expected = Arrays.asList(2, 4, 6, 8);
assertEquals(expected, evenNumbers);
}
-
- // Attributes
- // ------------------------------------------------------------------------
- private Generator<Integer> wrappedGenerator = null;
- private UnaryPredicate<Integer> isEven = new UnaryPredicate<Integer>()
- {
- public boolean test( Integer obj ) {
- return obj % 2 == 0;
- }
- };
- private Generator<Integer> filteredGenerator = null;
-
}
Modified: commons/proper/functor/branches/FUNCTOR-14-mm/core/src/test/java/org/apache/commons/functor/generator/loop/TestGenerateUntil.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/branches/FUNCTOR-14-mm/core/src/test/java/org/apache/commons/functor/generator/loop/TestGenerateUntil.java?rev=1439134&r1=1439133&r2=1439134&view=diff
==============================================================================
--- commons/proper/functor/branches/FUNCTOR-14-mm/core/src/test/java/org/apache/commons/functor/generator/loop/TestGenerateUntil.java (original)
+++ commons/proper/functor/branches/FUNCTOR-14-mm/core/src/test/java/org/apache/commons/functor/generator/loop/TestGenerateUntil.java Sun Jan 27 18:15:38 2013
@@ -30,8 +30,18 @@ import org.junit.Test;
* Tests the Generate Until class.
* @version $Revision$ $Date$
*/
-public class TestGenerateUntil
-{
+public class TestGenerateUntil {
+ // Attributes
+ // ------------------------------------------------------------------------
+ private static final Integer FIVE = new Integer(5);
+
+ private LoopGenerator<Integer> wrappedGenerator = null;
+ private UnaryPredicate<Integer> isMoreThanFive = new UnaryPredicate<Integer>() {
+ public boolean test( Integer obj ) {
+ return obj > FIVE;
+ }
+ };
+ private LoopGenerator<Integer> generateUntil = null;
@Before
public void setUp() throws Exception {
@@ -89,16 +99,4 @@ public class TestGenerateUntil
assertEquals(generateUntil.hashCode(), generateUntil.hashCode());
assertEquals(generateUntil.hashCode(), new GenerateUntil<Integer>(wrappedGenerator, isMoreThanFive).hashCode());
}
-
- // Attributes
- // ------------------------------------------------------------------------
- private static final Integer FIVE = new Integer(5);
-
- private LoopGenerator<Integer> wrappedGenerator = null;
- private UnaryPredicate<Integer> isMoreThanFive = new UnaryPredicate<Integer>() {
- public boolean test( Integer obj ) {
- return obj > FIVE;
- }
- };
- private LoopGenerator<Integer> generateUntil = null;
}
Modified: commons/proper/functor/branches/FUNCTOR-14-mm/core/src/test/java/org/apache/commons/functor/generator/loop/TestGenerateWhile.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/branches/FUNCTOR-14-mm/core/src/test/java/org/apache/commons/functor/generator/loop/TestGenerateWhile.java?rev=1439134&r1=1439133&r2=1439134&view=diff
==============================================================================
--- commons/proper/functor/branches/FUNCTOR-14-mm/core/src/test/java/org/apache/commons/functor/generator/loop/TestGenerateWhile.java (original)
+++ commons/proper/functor/branches/FUNCTOR-14-mm/core/src/test/java/org/apache/commons/functor/generator/loop/TestGenerateWhile.java Sun Jan 27 18:15:38 2013
@@ -30,8 +30,18 @@ import org.junit.Test;
* Tests the Generate While class.
* @version $Revision$ $Date$
*/
-public class TestGenerateWhile
-{
+public class TestGenerateWhile {
+ // Attributes
+ // ------------------------------------------------------------------------
+ private static final Integer FIVE = new Integer(5);
+
+ private LoopGenerator<Integer> wrappedGenerator = null;
+ private UnaryPredicate<Integer> isLessThanFive = new UnaryPredicate<Integer>() {
+ public boolean test( Integer obj ) {
+ return obj < FIVE;
+ }
+ };
+ private LoopGenerator<Integer> generateWhile = null;
@Before
public void setUp() throws Exception {
@@ -90,17 +100,4 @@ public class TestGenerateWhile
assertEquals(generateWhile.hashCode(), new GenerateWhile<Integer>(wrappedGenerator, isLessThanFive).hashCode());
}
- // Attributes
- // ------------------------------------------------------------------------
- private static final Integer FIVE = new Integer(5);
-
- private LoopGenerator<Integer> wrappedGenerator = null;
- private UnaryPredicate<Integer> isLessThanFive = new UnaryPredicate<Integer>()
- {
- public boolean test( Integer obj ) {
- return obj < FIVE;
- }
- };
- private LoopGenerator<Integer> generateWhile = null;
-
}
Modified: commons/proper/functor/branches/FUNCTOR-14-mm/core/src/test/java/org/apache/commons/functor/generator/loop/TestIteratorToGeneratorAdapter.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/branches/FUNCTOR-14-mm/core/src/test/java/org/apache/commons/functor/generator/loop/TestIteratorToGeneratorAdapter.java?rev=1439134&r1=1439133&r2=1439134&view=diff
==============================================================================
--- commons/proper/functor/branches/FUNCTOR-14-mm/core/src/test/java/org/apache/commons/functor/generator/loop/TestIteratorToGeneratorAdapter.java (original)
+++ commons/proper/functor/branches/FUNCTOR-14-mm/core/src/test/java/org/apache/commons/functor/generator/loop/TestIteratorToGeneratorAdapter.java Sun Jan 27 18:15:38 2013
@@ -39,18 +39,18 @@ import org.junit.Test;
@SuppressWarnings("unchecked")
public class TestIteratorToGeneratorAdapter extends BaseFunctorTest {
+ // Lifecycle
+ // ------------------------------------------------------------------------
+
+ private List<String> list = null;
+
@Override
public Object makeFunctor() {
List<String> list = new ArrayList<String>();
list.add("1");
return new IteratorToGeneratorAdapter<String>(list.iterator());
}
-
- // Lifecycle
- // ------------------------------------------------------------------------
-
- private List<String> list = null;
-
+
@Before
public void setUp() throws Exception {
list = new ArrayList<String>();
Modified: commons/proper/functor/branches/FUNCTOR-14-mm/core/src/test/java/org/apache/commons/functor/generator/loop/TestLoopGenerator.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/branches/FUNCTOR-14-mm/core/src/test/java/org/apache/commons/functor/generator/loop/TestLoopGenerator.java?rev=1439134&r1=1439133&r2=1439134&view=diff
==============================================================================
--- commons/proper/functor/branches/FUNCTOR-14-mm/core/src/test/java/org/apache/commons/functor/generator/loop/TestLoopGenerator.java (original)
+++ commons/proper/functor/branches/FUNCTOR-14-mm/core/src/test/java/org/apache/commons/functor/generator/loop/TestLoopGenerator.java Sun Jan 27 18:15:38 2013
@@ -35,6 +35,36 @@ import org.junit.Test;
*/
@SuppressWarnings("unchecked")
public class TestLoopGenerator {
+ // Attributes
+ // ------------------------------------------------------------------------
+ private List<Integer> list = null;
+ private List<Integer> doubled = null;
+ private List<Integer> evens = null;
+ private List<Integer> listWithDuplicates = null;
+ @SuppressWarnings("unused")
+ private int sum = 0;
+// private UnaryPredicate equalsThree = LeftBoundPredicate.bind(IsEqual.instance(),new Integer(3));
+// private UnaryPredicate equalsTwentyThree = LeftBoundPredicate.bind(IsEqual.instance(),new Integer(23));
+// private UnaryPredicate isEven = new UnaryPredicate() {
+// public boolean test(Object obj) {
+// return ((Number) obj).intValue() % 2 == 0;
+// }
+// };
+// private UnaryPredicate isOdd = new UnaryPredicate() {
+// public boolean test(Object obj) {
+// return ((Number) obj).intValue() % 2 != 0;
+// }
+// };
+
+ // Classes
+ // ------------------------------------------------------------------------
+
+ static class Summer implements UnaryProcedure<Number> {
+ public void run(Number that) {
+ sum += (that).intValue();
+ }
+ public int sum = 0;
+ }
private LoopGenerator<Integer> simpleGenerator = null;
@@ -172,34 +202,4 @@ public class TestLoopGenerator {
assertEquals("[0, 1, 2, 3, 4]", col.toString());
}
- // Attributes
- // ------------------------------------------------------------------------
- private List<Integer> list = null;
- private List<Integer> doubled = null;
- private List<Integer> evens = null;
- private List<Integer> listWithDuplicates = null;
- @SuppressWarnings("unused")
- private int sum = 0;
-// private UnaryPredicate equalsThree = LeftBoundPredicate.bind(IsEqual.instance(),new Integer(3));
-// private UnaryPredicate equalsTwentyThree = LeftBoundPredicate.bind(IsEqual.instance(),new Integer(23));
-// private UnaryPredicate isEven = new UnaryPredicate() {
-// public boolean test(Object obj) {
-// return ((Number) obj).intValue() % 2 == 0;
-// }
-// };
-// private UnaryPredicate isOdd = new UnaryPredicate() {
-// public boolean test(Object obj) {
-// return ((Number) obj).intValue() % 2 != 0;
-// }
-// };
-
- // Classes
- // ------------------------------------------------------------------------
-
- static class Summer implements UnaryProcedure<Number> {
- public void run(Number that) {
- sum += (that).intValue();
- }
- public int sum = 0;
- }
}
\ No newline at end of file
Modified: commons/proper/functor/branches/FUNCTOR-14-mm/core/src/test/java/org/apache/commons/functor/generator/loop/TestTransformedGenerator.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/branches/FUNCTOR-14-mm/core/src/test/java/org/apache/commons/functor/generator/loop/TestTransformedGenerator.java?rev=1439134&r1=1439133&r2=1439134&view=diff
==============================================================================
--- commons/proper/functor/branches/FUNCTOR-14-mm/core/src/test/java/org/apache/commons/functor/generator/loop/TestTransformedGenerator.java (original)
+++ commons/proper/functor/branches/FUNCTOR-14-mm/core/src/test/java/org/apache/commons/functor/generator/loop/TestTransformedGenerator.java Sun Jan 27 18:15:38 2013
@@ -31,8 +31,19 @@ import org.junit.Test;
* Tests the Transformed Generator class.
* @version $Revision$ $Date$
*/
-public class TestTransformedGenerator
-{
+public class TestTransformedGenerator {
+ // Attributes
+ // ------------------------------------------------------------------------
+ private static final Integer TWO = new Integer(2);
+
+ private LoopGenerator<Integer> wrappedGenerator = null;
+ private UnaryFunction<Integer, Integer> sumsTwo = new UnaryFunction<Integer, Integer>() {
+ public Integer evaluate( Integer obj ) {
+ return obj += TWO;
+ }
+ };
+ private TransformedGenerator<Integer, Integer> sumsTwoGenerator = null;
+
@Before
public void setUp() throws Exception {
@@ -106,17 +117,4 @@ public class TestTransformedGenerator
assertEquals(9, doubledValues.size());
assertEquals(expected, doubledValues);
}
-
- // Attributes
- // ------------------------------------------------------------------------
- private static final Integer TWO = new Integer(2);
-
- private LoopGenerator<Integer> wrappedGenerator = null;
- private UnaryFunction<Integer, Integer> sumsTwo = new UnaryFunction<Integer, Integer>() {
- public Integer evaluate( Integer obj ) {
- return obj += TWO;
- }
- };
- private TransformedGenerator<Integer, Integer> sumsTwoGenerator = null;
-
}
Modified: commons/proper/functor/branches/FUNCTOR-14-mm/core/src/test/java/org/apache/commons/functor/generator/loop/TestUntilGenerate.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/branches/FUNCTOR-14-mm/core/src/test/java/org/apache/commons/functor/generator/loop/TestUntilGenerate.java?rev=1439134&r1=1439133&r2=1439134&view=diff
==============================================================================
--- commons/proper/functor/branches/FUNCTOR-14-mm/core/src/test/java/org/apache/commons/functor/generator/loop/TestUntilGenerate.java (original)
+++ commons/proper/functor/branches/FUNCTOR-14-mm/core/src/test/java/org/apache/commons/functor/generator/loop/TestUntilGenerate.java Sun Jan 27 18:15:38 2013
@@ -35,8 +35,18 @@ import org.junit.Test;
* Tests the Until Generate class.
* @version $Revision$ $Date$
*/
-public class TestUntilGenerate
-{
+public class TestUntilGenerate {
+ // Attributes
+ // ------------------------------------------------------------------------
+ private static final Integer FIVE = new Integer(5);
+
+ private LoopGenerator<Integer> wrappedGenerator = null;
+ private UnaryPredicate<Integer> isLessThanFive = new UnaryPredicate<Integer>() {
+ public boolean test( Integer obj ) {
+ return obj < FIVE;
+ }
+ };
+ private LoopGenerator<Integer> untilGenerate = null;
@Before
public void setUp() throws Exception {
@@ -107,16 +117,4 @@ public class TestUntilGenerate
final List<Integer> expected = Arrays.asList(5, 6, 7, 8, 9);
assertEquals(expected, numbersGreaterThanFive);
}
-
- // Attributes
- // ------------------------------------------------------------------------
- private static final Integer FIVE = new Integer(5);
-
- private LoopGenerator<Integer> wrappedGenerator = null;
- private UnaryPredicate<Integer> isLessThanFive = new UnaryPredicate<Integer>() {
- public boolean test( Integer obj ) {
- return obj < FIVE;
- }
- };
- private LoopGenerator<Integer> untilGenerate = null;
}
Modified: commons/proper/functor/branches/FUNCTOR-14-mm/core/src/test/java/org/apache/commons/functor/generator/loop/TestWhileGenerate.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/branches/FUNCTOR-14-mm/core/src/test/java/org/apache/commons/functor/generator/loop/TestWhileGenerate.java?rev=1439134&r1=1439133&r2=1439134&view=diff
==============================================================================
--- commons/proper/functor/branches/FUNCTOR-14-mm/core/src/test/java/org/apache/commons/functor/generator/loop/TestWhileGenerate.java (original)
+++ commons/proper/functor/branches/FUNCTOR-14-mm/core/src/test/java/org/apache/commons/functor/generator/loop/TestWhileGenerate.java Sun Jan 27 18:15:38 2013
@@ -38,6 +38,18 @@ import org.junit.Test;
*/
public class TestWhileGenerate {
+ // Attributes
+ // ------------------------------------------------------------------------
+ private static final Integer FIVE = new Integer(5);
+
+ private LoopGenerator<Integer> wrappedGenerator = null;
+ private UnaryPredicate<Integer> isLessThanFive = new UnaryPredicate<Integer>() {
+ public boolean test( Integer obj ) {
+ return obj < FIVE;
+ }
+ };
+ private LoopGenerator<Integer> whileGenerate = null;
+
@Before
public void setUp() throws Exception {
wrappedGenerator = new IntegerRange(1, 10);
@@ -107,16 +119,4 @@ public class TestWhileGenerate {
List<Integer> expected = Arrays.asList(1, 2, 3, 4);
assertEquals(expected, numbersMinorThanFive);
}
-
- // Attributes
- // ------------------------------------------------------------------------
- private static final Integer FIVE = new Integer(5);
-
- private LoopGenerator<Integer> wrappedGenerator = null;
- private UnaryPredicate<Integer> isLessThanFive = new UnaryPredicate<Integer>() {
- public boolean test( Integer obj ) {
- return obj < FIVE;
- }
- };
- private LoopGenerator<Integer> whileGenerate = null;
}