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

    try {
      testSource(resolveScopeFromLifecycle(lifecycle, true));
      throw new AssertionError("Lifecycle resolution should have failed due to it being ended.");
    } catch (LifecycleEndedException ignored) {

    }
  }