@Test
public void testViewEffectsPostedImmediatelyAreSentCorrectly() {

  //noinspection Convert2MethodRef
  underTest =
      new MobiusLoopViewModel<>(
          (Consumer<TestViewEffect> consumer) -> {
            Connectable<TestEffect, TestEvent> viewEffectSendingEffectHandler =
                new ViewEffectSendingEffectHandler(consumer);
            testViewEffectHandler = new TestViewEffectHandler<>(consumer);
            return Mobius.loop(updateFunction, viewEffectSendingEffectHandler)
                .eventRunner(ImmediateWorkRunner::new)
                .effectRunner(ImmediateWorkRunner::new);
          },
          initialModel,
          (TestModel model) -> First.first(model, effects(new TestEffect("oops"))),
          new ImmediateWorkRunner(),
          100);
  underTest
      .getViewEffects()
      .setObserver(
          fakeLifecycle,
          recordingForegroundViewEffectObserver,
          recordingBackgroundEffectObserver);
  fakeLifecycle.handleLifecycleEvent(Lifecycle.Event.ON_RESUME);
  assertThat(recordingForegroundViewEffectObserver.valueCount(), equalTo(0));
  assertThat(recordingBackgroundEffectObserver.valueCount(), equalTo(1));
}