use of org.cactoos.Proc in project cactoos by yegor256.
the class AsyncFuncTest method runsAsProcInBackground.
@Test
public void runsAsProcInBackground() {
MatcherAssert.assertThat("Can't run proc in the background", input -> {
final CountDownLatch latch = new CountDownLatch(1);
new AsyncFunc<>((Proc<Boolean>) ipt -> latch.countDown()).exec(input);
latch.await();
return true;
}, new FuncApplies<>(true, Matchers.equalTo(true)));
}
use of org.cactoos.Proc in project cactoos by yegor256.
the class IoCheckedProcTest method rethrowsIoException.
@Test
void rethrowsIoException() {
final IOException exception = new IOException("intended");
new Assertion<>("Must rethrow original IOException", () -> {
new IoCheckedProc<>((Proc<Integer>) i -> {
throw exception;
}).exec(1);
return null;
}, new Throws<>(exception.getMessage(), exception.getClass())).affirm();
}
Aggregations