commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simone Tripodi <simonetrip...@apache.org>
Subject Re: svn commit: r1363382 - in /commons/proper/functor/trunk/src: main/java/org/apache/commons/functor/core/composite/UnarySequence.java test/java/org/apache/commons/functor/core/composite/TestUnarySequence.java
Date Thu, 19 Jul 2012 16:05:07 GMT
very good, I was waiting for you! :)

two minor observations:

 * we usually mark resolved issue with [FUNCTOR-XX] rather than FIXED
FUNCTOR-XX - not a big deal, but feel free to modify the log message;

 * can you please track the issue in the src/main/changes.xml file?

many thanks in advance, all the best!
-Simo

http://people.apache.org/~simonetripodi/
http://simonetripodi.livejournal.com/
http://twitter.com/simonetripodi
http://www.99soft.org/


On Thu, Jul 19, 2012 at 5:23 PM,  <kinow@apache.org> wrote:
> Author: kinow
> Date: Thu Jul 19 15:23:19 2012
> New Revision: 1363382
>
> URL: http://svn.apache.org/viewvc?rev=1363382&view=rev
> Log:
> FIXED FUNCTOR-21: Added an extra verification in the then() method of UnarySequence to
avoid the NPE. Tests in place.
>
> Modified:
>     commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/UnarySequence.java
>     commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestUnarySequence.java
>
> Modified: commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/UnarySequence.java
> URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/UnarySequence.java?rev=1363382&r1=1363381&r2=1363382&view=diff
> ==============================================================================
> --- commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/UnarySequence.java
(original)
> +++ commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/UnarySequence.java
Thu Jul 19 15:23:19 2012
> @@ -98,7 +98,9 @@ public class UnarySequence<A> implements
>       * @return this
>       */
>      public UnarySequence<A> then(UnaryProcedure<? super A> p) {
> -        list.add(p);
> +        if (p != null) {
> +            list.add(p);
> +        }
>          return this;
>      }
>
>
> 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=1363382&r1=1363381&r2=1363382&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
Thu Jul 19 15:23:19 2012
> @@ -17,6 +17,7 @@
>  package org.apache.commons.functor.core.composite;
>
>  import static org.junit.Assert.assertEquals;
> +import static org.junit.Assert.assertFalse;
>
>  import java.util.ArrayList;
>  import java.util.List;
> @@ -44,6 +45,26 @@ public class TestUnarySequence extends B
>      // ------------------------------------------------------------------------
>
>      @Test
> +    public void testConstructors() throws Exception {
> +        UnarySequence<Object> seq1 = new UnarySequence<Object>((UnaryProcedure<?
super Object>)null);
> +        UnarySequence<Object> seq2 = new UnarySequence<Object>();
> +        assertObjectsAreEqual(seq1, seq2);
> +
> +        RunCounter p1 = new RunCounter();
> +        RunCounter p2 = new RunCounter();
> +        List<UnaryProcedure<? super Object>> iterable = new ArrayList<UnaryProcedure<?
super Object>>();
> +        iterable.add(p1);
> +        iterable.add(p2);
> +        UnarySequence<Object> seq3 = new UnarySequence<Object>(iterable);
> +        UnarySequence<Object> seq4 = new UnarySequence<Object>(p1, p2);
> +        assertObjectsAreEqual(seq3, seq4);
> +
> +        UnarySequence<Object> seq5 = new UnarySequence<Object>((Iterable<UnaryProcedure<?
super Object>>)null);
> +        UnarySequence<Object> seq6 = new UnarySequence<Object>((UnaryProcedure<?
super Object>[])null);
> +        assertObjectsAreEqual(seq5, seq6);
> +    }
> +
> +    @Test
>      public void testRunZero() throws Exception {
>          UnarySequence<String> seq = new UnarySequence<String>();
>          seq.run(null);
> @@ -110,6 +131,7 @@ public class TestUnarySequence extends B
>          }
>
>          assertObjectsAreNotEqual(p,new NoOp());
> +        assertFalse(p.equals(null));
>      }
>
>      // Classes
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message