Skip to content

Commit

Permalink
yegor256#455 fixed the issue
Browse files Browse the repository at this point in the history
  • Loading branch information
bedward70 committed Nov 3, 2017
1 parent 54747c0 commit 377b5e6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/main/java/org/cactoos/Proc.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public void exec(final X input) throws Exception {
"NULL instead of a valid input"
);
}
this.origin.exec(input);
}
}
}
12 changes: 11 additions & 1 deletion src/test/java/org/cactoos/ProcTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
*/
package org.cactoos;

import java.util.concurrent.atomic.AtomicInteger;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.Test;

/**
Expand All @@ -46,6 +49,13 @@ public void failForNullInput() throws Exception {

@Test
public void okForNoNulls() throws Exception {
new Proc.NoNulls<>(input -> { }).exec(new Object());
final AtomicInteger counter = new AtomicInteger();
new Proc.NoNulls<AtomicInteger>(input -> { input.incrementAndGet(); })
.exec(counter);
MatcherAssert.assertThat(
"Can't involve the \"Proc.exec(X input)\" method",
counter.get(),
Matchers.equalTo(1)
);
}
}

0 comments on commit 377b5e6

Please sign in to comment.