### Question:
Chain implements
        Conditional<Chain<T>, T>,
        Internal<Chain<T>, T>,
        Callable<T>,
        Function<Consumer<T>, Chain<T>>,
        DefaultIfEmpty<T>,
        And<T>,
        Monad<T>,
        Functor<T> { public Chain<T> debug(Consumer<T> action) { if (configuration.isDebugging()) { Invoker.invoke(action, item); } return new Chain<>(item, configuration); } Chain(T item, InternalConfiguration configuration); static Optional<T> optional(@Nullable T item); static Chain<T> let(@NonNull T item); static Chain<T> call(@NonNull Callable<T> callable); Guard<Chain<R>, R> guardMap(Function<T, R> guardMapper); @Override Proxy<Chain<T>, T> access(); Guard<Chain<T>, T> guard(Consumer<T> action); Condition<Chain<T>, T> when(Predicate<T> predicate); Condition<Chain<T>, T> whenNot(Predicate<T> predicate); Condition<Chain<T>, T> whenEmpty(); Condition<Chain<T>, T> whenNotEmpty(); @Deprecated Chain<Pair<T, Boolean>> in(Collection<T> collection); @Deprecated Chain<Pair<T, Boolean>> in(Collection<T> collection, BiPredicate<T, T> comparator); Condition<Chain<T>, T> whenIn(Collection<T> collection); Condition<Chain<T>, T> whenIn(Collection<T> collection, BiPredicate<T, T> comparator); Condition<Chain<T>, T> whenNotIn(Collection<T> collection); Condition<Chain<T>, T> whenNotIn(Collection<T> collection, BiPredicate<T, T> comparator); @Override R flatMap(@NonNull Function<T, R> flatMapper); Chain<T> apply(Consumer<T> action); Chain<T> invoke(Action action); Chain<R> map(@NonNull Function<T, R> mapper); Chain<R> to(@NonNull R item); Chain<R> to(@NonNull Callable<R> itemCallable); @Override T call(); @Override Chain<T> defaultIfEmpty(@NonNull T defaultValue); Chain<T> debug(Consumer<T> action); @Override Collector<T> and(T item); Chain<Pair<T, R>> pair(R item); Chain<Pair<T, R>> pair(Function<T, R> pairedItemMapper); @SuppressWarnings("unchecked") Collector<R> collect(Class<R> type); Logger<Chain<T>, T> log(Object tag); Lazy<T> lazyApply(final Consumer<T> lazyAction); Lazy<R> lazyMap(final Function<T, R> lazyMapper);  }### Answer:
@Test public void debugWhileChainConfigIsDebuggingThenInvokeDebug() { InternalConfiguration config = InternalConfiguration .getInstance("debugWhileChainConfigIsDebuggingThenInvokeDebug"); config.setDebugging(true); final boolean[] result = {false}; new Chain<>(new TestClass(), config) .debug(new Consumer<TestClass>() { @Override public void accept(@NonNull TestClass testClass) throws Exception { result[0] = true; } }); assertTrue(result[0]); }
@Test public void debugWhileChainConfigIsNotDebuggingThenDoNotInvokeDebug() { InternalConfiguration config = InternalConfiguration .getInstance("debugWhileChainConfigIsNotDebuggingThenDoNotInvokeDebug"); config.setDebugging(false); final boolean[] result = {false}; new Chain<>(new TestClass(), config) .debug(new Consumer<TestClass>() { @Override public void accept(@NonNull TestClass testClass) throws Exception { result[0] = true; } }); assertFalse(result[0]); }