### Question:
TaskBasedSignalOffloader implements SignalOffloader { @Override public <T> void offloadSubscribe(final Subscriber<? super T> subscriber, final Consumer<Subscriber<? super T>> handleSubscribe) { try { executor.execute(() -> handleSubscribe.accept(subscriber)); } catch (Throwable throwable) { deliverErrorFromSource(subscriber, throwable); } } TaskBasedSignalOffloader(final Executor executor);   TaskBasedSignalOffloader(final Executor executor, final int publisherSignalQueueInitialCapacity); @Override Subscriber<? super T> offloadSubscriber(final Subscriber<? super T> subscriber); @Override SingleSource.Subscriber<? super T> offloadSubscriber(
            final SingleSource.Subscriber<? super T> subscriber); @Override CompletableSource.Subscriber offloadSubscriber(final CompletableSource.Subscriber subscriber); @Override Subscriber<? super T> offloadSubscription(final Subscriber<? super T> subscriber); @Override SingleSource.Subscriber<? super T> offloadCancellable(
            final SingleSource.Subscriber<? super T> subscriber); @Override CompletableSource.Subscriber offloadCancellable(final CompletableSource.Subscriber subscriber); @Override void offloadSubscribe(final Subscriber<? super T> subscriber,
                                     final Consumer<Subscriber<? super T>> handleSubscribe); @Override void offloadSubscribe(final SingleSource.Subscriber<? super T> subscriber,
                                     final Consumer<SingleSource.Subscriber<? super T>> handleSubscribe); @Override void offloadSubscribe(final CompletableSource.Subscriber subscriber,
                                 final Consumer<CompletableSource.Subscriber> handleSubscribe); @Override void offloadSignal(final T signal, final Consumer<T> signalConsumer);  }### Answer:
@Test public void offloadSubscribePublisher() { Consumer<Subscriber<? super Integer>> handleSubscribe = uncheckedMock(Consumer.class); offloader.offloadSubscribe(pubSub, handleSubscribe); verify(executor.mock).execute(any()); verifyZeroInteractions(pubSub); verifyZeroInteractions(handleSubscribe); assertThat("Unexpected tasks executed.", executor.executeAllTasks(), is(1)); verify(handleSubscribe).accept(pubSub); }
@Test public void offloadSubscribeSingle() { Consumer<SingleSource.Subscriber<? super Integer>> handleSubscribe = uncheckedMock(Consumer.class); offloader.offloadSubscribe(singleSub, handleSubscribe); verify(executor.mock).execute(any()); verifyZeroInteractions(singleSub); verifyZeroInteractions(handleSubscribe); assertThat("Unexpected tasks executed.", executor.executeAllTasks(), is(1)); verify(handleSubscribe).accept(singleSub); }
@Test public void offloadSubscribeCompletable() { Consumer<CompletableSource.Subscriber> handleSubscribe = uncheckedMock(Consumer.class); offloader.offloadSubscribe(completableSub, handleSubscribe); verify(executor.mock).execute(any()); verifyZeroInteractions(completableSub); verifyZeroInteractions(handleSubscribe); assertThat("Unexpected tasks executed.", executor.executeAllTasks(), is(1)); verify(handleSubscribe).accept(completableSub); }