Author: simonetripodi Date: Thu May 31 15:48:20 2012 New Revision: 1344781 URL: http://svn.apache.org/viewvc?rev=1344781&view=rev Log: expected NPE, caucght IAE, tests were broken
Modified: commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/generator/TestFilteredGenerator.java commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/generator/TestGenerateUntil.java commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/generator/TestGenerateWhile.java commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/generator/TestTransformedGenerator.java commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/generator/TestUntilGenerate.java commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/generator/TestWhileGenerate.java Modified: commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/generator/TestFilteredGenerator.java URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/generator/TestFilteredGenerator.java?rev=1344781&r1=1344780&r2=1344781&view=diff ============================================================================== --- commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/generator/TestFilteredGenerator.java (original) +++ commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/generator/TestFilteredGenerator.java Thu May 31 15:48:20 2012 @@ -38,13 +38,13 @@ import org.junit.Test; */ public class TestFilteredGenerator { - + @Before public void setUp() throws Exception { wrappedGenerator = new IntegerRange(1, 10); filteredGenerator = new FilteredGenerator<Integer>(wrappedGenerator, isEven); } - + @After public void tearDown() { wrappedGenerator = null; @@ -54,49 +54,49 @@ public class TestFilteredGenerator // Tests // ------------------------------------------------------------------------ - + @Test public void testConstructorProhibitsNull() { try { new FilteredGenerator<Integer>(filteredGenerator, null); fail("ExpectedNullPointerException"); - } catch(IllegalArgumentException e) { + } catch(NullPointerException e) { // expected } try { new FilteredGenerator<Integer>(null, isEven); fail("ExpectedNullPointerException"); - } catch(IllegalArgumentException e) { + } catch(NullPointerException e) { // expected } try { new FilteredGenerator<Integer>(null, null); fail("ExpectedNullPointerException"); - } catch(IllegalArgumentException e) { + } catch(NullPointerException e) { // expected } } - + @Test public void testEquals() { Generator<Integer> anotherGenerate = new FilteredGenerator<Integer>(new IntegerRange(1, 10), isEven); assertEquals(filteredGenerator, filteredGenerator); assertEquals(filteredGenerator, anotherGenerate); assertTrue(!filteredGenerator.equals((FilteredGenerator<Integer>)null)); - + Generator<Integer> aGenerateWithADifferentPredicate = new FilteredGenerator<Integer>( new IntegerRange(1, 10), new UnaryPredicate<Integer>() { public boolean test(Integer obj) { return obj % 2 == 0; } }); - + assertTrue(!filteredGenerator.equals(aGenerateWithADifferentPredicate)); - + Generator<Integer> aGenerateWithADifferentWrapped = new FilteredGenerator<Integer>(new IntegerRange(1,11), isEven); assertTrue(!filteredGenerator.equals(aGenerateWithADifferentWrapped)); } - + @Test public void testHashcode() { assertEquals(filteredGenerator.hashCode(), filteredGenerator.hashCode()); @@ -108,7 +108,7 @@ public class TestFilteredGenerator } }.hashCode()); } - + @Test public void testGenerate() { final List<Integer> evenNumbers = new ArrayList<Integer>(); @@ -118,7 +118,7 @@ public class TestFilteredGenerator } }); assertEquals(4, evenNumbers.size()); - + List<Integer> expected = Arrays.asList(2, 4, 6, 8); assertEquals(expected, evenNumbers); } @@ -133,5 +133,5 @@ public class TestFilteredGenerator } }; private Generator<Integer> filteredGenerator = null; - + } Modified: commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/generator/TestGenerateUntil.java URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/generator/TestGenerateUntil.java?rev=1344781&r1=1344780&r2=1344781&view=diff ============================================================================== --- commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/generator/TestGenerateUntil.java (original) +++ commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/generator/TestGenerateUntil.java Thu May 31 15:48:20 2012 @@ -33,13 +33,13 @@ import org.junit.Test; */ public class TestGenerateUntil { - + @Before public void setUp() throws Exception { wrappedGenerator = new IntegerRange(1, 10); generateUntil = new GenerateUntil<Integer>(wrappedGenerator, isMoreThanFive); } - + @After public void tearDown() { wrappedGenerator = null; @@ -49,49 +49,49 @@ public class TestGenerateUntil // Tests // ------------------------------------------------------------------------ - + @Test public void testConstructorProhibitsNull() { try { new GenerateUntil<Integer>(generateUntil, null); fail("ExpectedNullPointerException"); - } catch(IllegalArgumentException e) { + } catch(NullPointerException e) { // expected } try { new GenerateUntil<Integer>(null, isMoreThanFive); fail("ExpectedNullPointerException"); - } catch(IllegalArgumentException e) { + } catch(NullPointerException e) { // expected } try { new GenerateUntil<Integer>(null, null); fail("ExpectedNullPointerException"); - } catch(IllegalArgumentException e) { + } catch(NullPointerException e) { // expected } } - + @Test public void testEquals() { Generator<Integer> anotherGenerate = new GenerateUntil<Integer>(new IntegerRange(1, 10), isMoreThanFive); assertEquals(generateUntil, generateUntil); assertEquals(generateUntil, anotherGenerate); assertTrue(!generateUntil.equals((GenerateUntil<Integer>)null)); - + Generator<Integer> aGenerateWithADifferentPredicate = new GenerateUntil<Integer>( - new IntegerRange(1, 10), + new IntegerRange(1, 10), new UnaryPredicate<Integer>() { public boolean test(Integer obj) { return obj > FIVE; } }); assertTrue(!generateUntil.equals(aGenerateWithADifferentPredicate)); - + Generator<Integer> aGenerateWithADifferentWrapped = new GenerateUntil<Integer>(new IntegerRange(1,2), isMoreThanFive); assertTrue(!generateUntil.equals(aGenerateWithADifferentWrapped)); } - + @Test public void testHashcode() { assertEquals(generateUntil.hashCode(), generateUntil.hashCode()); @@ -108,7 +108,7 @@ public class TestGenerateUntil // Attributes // ------------------------------------------------------------------------ private static final Integer FIVE = new Integer(5); - + private Generator<Integer> wrappedGenerator = null; private UnaryPredicate<Integer> isMoreThanFive = new UnaryPredicate<Integer>() { public boolean test( Integer obj ) { Modified: commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/generator/TestGenerateWhile.java URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/generator/TestGenerateWhile.java?rev=1344781&r1=1344780&r2=1344781&view=diff ============================================================================== --- commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/generator/TestGenerateWhile.java (original) +++ commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/generator/TestGenerateWhile.java Thu May 31 15:48:20 2012 @@ -33,13 +33,13 @@ import org.junit.Test; */ public class TestGenerateWhile { - + @Before public void setUp() throws Exception { wrappedGenerator = new IntegerRange(1, 10); generateWhile = new GenerateWhile<Integer>(wrappedGenerator, isLessThanFive); } - + @After public void tearDown() { wrappedGenerator = null; @@ -49,49 +49,49 @@ public class TestGenerateWhile // Tests // ------------------------------------------------------------------------ - + @Test public void testConstructorProhibitsNull() { try { new GenerateWhile<Integer>(generateWhile, null); fail("ExpectedNullPointerException"); - } catch(IllegalArgumentException e) { + } catch(NullPointerException e) { // expected } try { new GenerateWhile<Integer>(null, isLessThanFive); fail("ExpectedNullPointerException"); - } catch(IllegalArgumentException e) { + } catch(NullPointerException e) { // expected } try { new GenerateWhile<Integer>(null, null); fail("ExpectedNullPointerException"); - } catch(IllegalArgumentException e) { + } catch(NullPointerException e) { // expected } } - + @Test public void testEquals() { Generator<Integer> anotherGenerate = new GenerateWhile<Integer>(new IntegerRange(1, 10), isLessThanFive); assertEquals(generateWhile, generateWhile); assertEquals(generateWhile, anotherGenerate); assertTrue(!generateWhile.equals((GenerateWhile<Integer>)null)); - + Generator<Integer> aGenerateWithADifferentPredicate = new GenerateWhile<Integer>( new IntegerRange(1, 10), new UnaryPredicate<Integer>() { public boolean test(Integer obj) { return obj < FIVE; } }); - + assertTrue(!generateWhile.equals(aGenerateWithADifferentPredicate)); - + Generator<Integer> aGenerateWithADifferentWrapped = new GenerateWhile<Integer>(new IntegerRange(1,11), isLessThanFive); assertTrue(!generateWhile.equals(aGenerateWithADifferentWrapped)); } - + @Test public void testHashcode() { assertEquals(generateWhile.hashCode(), generateWhile.hashCode()); @@ -107,7 +107,7 @@ public class TestGenerateWhile // Attributes // ------------------------------------------------------------------------ private static final Integer FIVE = new Integer(5); - + private Generator<Integer> wrappedGenerator = null; private UnaryPredicate<Integer> isLessThanFive = new UnaryPredicate<Integer>() { @@ -116,5 +116,5 @@ public class TestGenerateWhile } }; private Generator<Integer> generateWhile = null; - + } Modified: commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/generator/TestTransformedGenerator.java URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/generator/TestTransformedGenerator.java?rev=1344781&r1=1344780&r2=1344781&view=diff ============================================================================== --- commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/generator/TestTransformedGenerator.java (original) +++ commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/generator/TestTransformedGenerator.java Thu May 31 15:48:20 2012 @@ -56,19 +56,19 @@ public class TestTransformedGenerator try { new TransformedGenerator<Integer, Integer>(null, sumsTwo); fail("ExpectedNullPointerException"); - } catch(IllegalArgumentException e) { + } catch(NullPointerException e) { // expected } try { new TransformedGenerator<Integer, Integer>(wrappedGenerator, null); fail("ExpectedNullPointerException"); - } catch(IllegalArgumentException e) { + } catch(NullPointerException e) { // expected } try { new TransformedGenerator<Integer, Integer>(null, null); fail("ExpectedNullPointerException"); - } catch(IllegalArgumentException e) { + } catch(NullPointerException e) { // expected } } Modified: commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/generator/TestUntilGenerate.java URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/generator/TestUntilGenerate.java?rev=1344781&r1=1344780&r2=1344781&view=diff ============================================================================== --- commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/generator/TestUntilGenerate.java (original) +++ commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/generator/TestUntilGenerate.java Thu May 31 15:48:20 2012 @@ -38,13 +38,13 @@ import org.junit.Test; */ public class TestUntilGenerate { - + @Before public void setUp() throws Exception { wrappedGenerator = new IntegerRange(1, 10); untilGenerate = new UntilGenerate<Integer>(isLessThanFive, wrappedGenerator); } - + @After public void tearDown() { wrappedGenerator = null; @@ -54,36 +54,36 @@ public class TestUntilGenerate // Tests // ------------------------------------------------------------------------ - + @Test public void testConstructorProhibitsNull() { try { new UntilGenerate<Integer>(null, untilGenerate); fail("ExpectedNullPointerException"); - } catch(IllegalArgumentException e) { + } catch(NullPointerException e) { // expected } try { new UntilGenerate<Integer>(isLessThanFive, null); fail("ExpectedNullPointerException"); - } catch(IllegalArgumentException e) { + } catch(NullPointerException e) { // expected } try { new UntilGenerate<Integer>(null, null); fail("ExpectedNullPointerException"); - } catch(IllegalArgumentException e) { + } catch(NullPointerException e) { // expected } } - + @Test public void testEquals() { Generator<Integer> anotherGenerate = new UntilGenerate<Integer>(isLessThanFive, new IntegerRange(1, 10)); assertEquals(untilGenerate, untilGenerate); assertEquals(untilGenerate, anotherGenerate); assertTrue(!untilGenerate.equals((UntilGenerate<Integer>)null)); - + Generator<Integer> aGenerateWithADifferentPredicate = new UntilGenerate<Integer>( new UnaryPredicate<Integer>() { public boolean test(Integer obj) { @@ -91,11 +91,11 @@ public class TestUntilGenerate } }, new IntegerRange(1, 10)); assertTrue(!untilGenerate.equals(aGenerateWithADifferentPredicate)); - + Generator<Integer> aGenerateWithADifferentWrapped = new UntilGenerate<Integer>(isLessThanFive, new IntegerRange(1,2)); assertTrue(!untilGenerate.equals(aGenerateWithADifferentWrapped)); } - + @Test public void testHashcode() { assertEquals(untilGenerate.hashCode(), untilGenerate.hashCode()); @@ -108,7 +108,7 @@ public class TestUntilGenerate } }.hashCode()); } - + @Test public void testGenerate() { final List<Integer> numbersGreaterThanFive = new ArrayList<Integer>(); @@ -118,7 +118,7 @@ public class TestUntilGenerate } }); assertEquals(5, numbersGreaterThanFive.size()); - + final List<Integer> expected = Arrays.asList(5, 6, 7, 8, 9); assertEquals(expected, numbersGreaterThanFive); } @@ -126,7 +126,7 @@ public class TestUntilGenerate // Attributes // ------------------------------------------------------------------------ private static final Integer FIVE = new Integer(5); - + private Generator<Integer> wrappedGenerator = null; private UnaryPredicate<Integer> isLessThanFive = new UnaryPredicate<Integer>() { public boolean test( Integer obj ) { Modified: commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/generator/TestWhileGenerate.java URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/generator/TestWhileGenerate.java?rev=1344781&r1=1344780&r2=1344781&view=diff ============================================================================== --- commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/generator/TestWhileGenerate.java (original) +++ commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/generator/TestWhileGenerate.java Thu May 31 15:48:20 2012 @@ -37,52 +37,52 @@ import org.junit.Test; * @author Bruno P. Kinoshita (brunodepau...@yahoo.com.br) */ public class TestWhileGenerate { - + @Before public void setUp() throws Exception { wrappedGenerator = new IntegerRange(1, 10); whileGenerate = new WhileGenerate<Integer>(isLessThanFive, wrappedGenerator); } - + @After public void tearDown() { wrappedGenerator = null; isLessThanFive = null; whileGenerate = null; } - + // Tests // ------------------------------------------------------------------------ - + @Test public void testConstructorProhibitsNull() { try { new WhileGenerate<Integer>(null, whileGenerate); fail("ExpectedNullPointerException"); - } catch(IllegalArgumentException e) { + } catch(NullPointerException e) { // expected } try { new WhileGenerate<Integer>(isLessThanFive, null); fail("ExpectedNullPointerException"); - } catch(IllegalArgumentException e) { + } catch(NullPointerException e) { // expected } try { new WhileGenerate<Integer>(null, null); fail("ExpectedNullPointerException"); - } catch(IllegalArgumentException e) { + } catch(NullPointerException e) { // expected } } - + @Test public void testEquals() { Generator<Integer> anotherGenerate = new WhileGenerate<Integer>(isLessThanFive, new IntegerRange(1, 10)); assertEquals(whileGenerate, whileGenerate); assertEquals(whileGenerate, anotherGenerate); assertTrue(!whileGenerate.equals((WhileGenerate<Integer>)null)); - + Generator<Integer> aGenerateWithADifferentPredicate = new WhileGenerate<Integer>( new UnaryPredicate<Integer>() { public boolean test(Integer obj) { @@ -90,11 +90,11 @@ public class TestWhileGenerate { } }, new IntegerRange(1, 10)); assertTrue(!whileGenerate.equals(aGenerateWithADifferentPredicate)); - + Generator<Integer> aGenerateWithADifferentWrapped = new WhileGenerate<Integer>(isLessThanFive, new IntegerRange(1,11)); assertTrue(!whileGenerate.equals(aGenerateWithADifferentWrapped)); } - + @Test public void testHashcode() { assertEquals(whileGenerate.hashCode(), whileGenerate.hashCode()); @@ -106,7 +106,7 @@ public class TestWhileGenerate { } }.hashCode()); } - + @Test public void testGenerate() { final List<Integer> numbersMinorThanFive = new ArrayList<Integer>(); @@ -124,7 +124,7 @@ public class TestWhileGenerate { // Attributes // ------------------------------------------------------------------------ private static final Integer FIVE = new Integer(5); - + private Generator<Integer> wrappedGenerator = null; private UnaryPredicate<Integer> isLessThanFive = new UnaryPredicate<Integer>() { public boolean test( Integer obj ) {