@Test
  public void testLifecycle_F2_F3_F1_C() {
    DataSource<Object> dataSource = getAndSubscribe();
    DataSubscriber<Object> subscriber1 = verifyGetAndSubscribeM(mDataSourceSupplier1, mSrc1);
    DataSubscriber<Object> subscriber2 = verifyGetAndSubscribeM(mDataSourceSupplier2, mSrc2);
    DataSubscriber<Object> subscriber3 = verifyGetAndSubscribe(mDataSourceSupplier3, mSrc3);

    setState(mSrc2, NOT_CLOSED, FINISHED, WITHOUT_RESULT, null, FAILED, mock(Throwable.class));
    subscriber2.onFailure(mSrc2);
    mInOrder.verify(mSrc2).close();
    verifySubscriber(dataSource, mSrc2, NO_INTERACTIONS);
    verifyState(dataSource, null, NOT_CLOSED, NOT_FINISHED, WITHOUT_RESULT, null, NOT_FAILED, null);

    setState(mSrc3, NOT_CLOSED, FINISHED, WITHOUT_RESULT, null, FAILED, mock(Throwable.class));
    subscriber3.onFailure(mSrc3);
    mInOrder.verify(mSrc3).close();
    verifySubscriber(dataSource, mSrc3, NO_INTERACTIONS);
    verifyState(dataSource, null, NOT_CLOSED, NOT_FINISHED, WITHOUT_RESULT, null, NOT_FAILED, null);

    Throwable throwable = mock(Throwable.class);
    setState(mSrc1, NOT_CLOSED, FINISHED, WITHOUT_RESULT, null, FAILED, throwable);
    subscriber1.onFailure(mSrc1);
    mInOrder.verify(mSrc1).close();
    verifySubscriber(dataSource, mSrc1, ON_FAILURE);
    verifyState(dataSource, null, NOT_CLOSED, FINISHED, WITHOUT_RESULT, null, FAILED, throwable);

    testClose(dataSource);
    verifyState(dataSource, null, CLOSED, FINISHED, WITHOUT_RESULT, null, FAILED, throwable);
  }
All data sources failed, highest-quality failed last, no intermediate results.
fbcore/src/test/java/com/facebook/datasource/IncreasingQualityDataSourceSupplierTest.java