public static IntConsumerChainer intConsumer( final ThrowingIntConsumer consumer) { return new IntConsumerChainer(consumer); }
@Override public IntConsumer sneakyThrow() { return value -> { try { throwing.doAccept(value); } catch (Error | RuntimeException e) { throw e; } catch (Throwable throwable) { throw doSneakyThrow(throwable); } }; }
@Override public <E extends RuntimeException> ThrowingIntConsumer orThrow( final Class<E> exclass) { return value -> { try { throwing.doAccept(value); } catch (Error | RuntimeException e) { throw e; } catch (Throwable throwable) { throw rethrow(exclass, throwable); } }; }
@Test public void orDoNothingTest() throws Throwable { final ThrowingIntConsumer throwing = getThrowing(); configureFull(throwing); final IntConsumer chain = getChain(throwing).orDoNothing(); final Callable<Type1> callable = toCallable(chain); assertThat(callable.call()).isSameAs(ret1); assertThat(callable.call()).isSameAs(ret1); verifyUncheckedThrow(callable); verifyErrorThrow(callable); } }
@Override public IntConsumer sneakyThrow() { return value -> { try { throwing.doAccept(value); } catch (Error | RuntimeException e) { throw e; } catch (Throwable throwable) { throw doSneakyThrow(throwable); } }; }
@Override public <E extends RuntimeException> ThrowingIntConsumer orThrow( final Class<E> exclass) { return value -> { try { throwing.doAccept(value); } catch (Error | RuntimeException e) { throw e; } catch (Throwable throwable) { throw rethrow(exclass, throwable); } }; }
public static IntConsumerChainer intConsumer( final ThrowingIntConsumer consumer) { return new IntConsumerChainer(consumer); }
@Override public IntConsumerChainer orTryWith( final ThrowingIntConsumer other) { final ThrowingIntConsumer consumer = value -> { try { throwing.doAccept(value); } catch (Error | RuntimeException e) { throw e; } catch (Throwable ignored) { other.doAccept(value); } }; return new IntConsumerChainer(consumer); }
@Override public IntConsumerChainer orTryWith( final ThrowingIntConsumer other) { final ThrowingIntConsumer consumer = value -> { try { throwing.doAccept(value); } catch (Error | RuntimeException e) { throw e; } catch (Throwable ignored) { other.doAccept(value); } }; return new IntConsumerChainer(consumer); }