public static <@NonNull E> CompletableSource resolveScopeFromLifecycle(
      final LifecycleScopeProvider<E> provider) throws OutsideScopeException {
    return resolveScopeFromLifecycle(provider, true);
  }
@Test
  public void lifecycleCheckEnd_shouldFailIfEndedWithHandler() {
    TestLifecycleScopeProvider lifecycle = TestLifecycleScopeProvider.createInitial(STOPPED);

    AutoDisposePlugins.setOutsideScopeHandler(
        e -> {
          // Swallow the exception.
        });

    testSource(resolveScopeFromLifecycle(lifecycle, true)).assertComplete();
  }