diff --git a/src/test/java/org/cactoos/func/IoCheckedBiProcTest.java b/src/test/java/org/cactoos/func/IoCheckedBiProcTest.java index 6caa29198f..c75c79609c 100644 --- a/src/test/java/org/cactoos/func/IoCheckedBiProcTest.java +++ b/src/test/java/org/cactoos/func/IoCheckedBiProcTest.java @@ -23,27 +23,39 @@ */ package org.cactoos.func; +import java.io.IOException; +import java.util.concurrent.atomic.AtomicInteger; import org.hamcrest.core.IsEqual; import org.junit.Test; import org.llorllale.cactoos.matchers.Assertion; import org.llorllale.cactoos.matchers.Throws; -import java.io.IOException; - /** * Test case for {@link IoCheckedBiFunc}. * @since 1.0 * @checkstyle JavadocMethodCheck (500 lines) */ public final class IoCheckedBiProcTest { + @Test + public void executesWrappedProc() throws Exception { + final AtomicInteger counter = new AtomicInteger(); + new IoCheckedBiProc<>( + (first, second) -> counter.incrementAndGet() + ).exec(true, true); + new Assertion<>( + "Must execute wrapped proc", + counter::get, + new IsEqual<>(1) + ).affirm(); + } + @Test public void wrapsExceptions() { - IoCheckedBiProc proc = new IoCheckedBiProc<>( + final IoCheckedBiProc proc = new IoCheckedBiProc<>( (first, second) -> { throw new Exception(); } ); - new Assertion<>( "Must wrap with IOException", () -> { @@ -77,12 +89,12 @@ public void rethrowsIoException() { @Test public void runtimeExceptionGoesOut() { - IoCheckedBiProc proc = new IoCheckedBiProc<>( + final String msg = "intended to fail here"; + final IoCheckedBiProc proc = new IoCheckedBiProc<>( (fst, scd) -> { - throw new IllegalStateException("intended to fail here"); + throw new IllegalStateException(msg); } ); - new Assertion<>( "Must re-throw runtime exceptions", () -> { @@ -90,7 +102,7 @@ public void runtimeExceptionGoesOut() { return true; }, new Throws<>( - "intended to fail here", + msg, IllegalStateException.class ) ).affirm();