@Test
  public void testLifecycle_ImmediateLowRes() {
    Object val2a = mock(Object.class);
    setState(mSrc2, NOT_CLOSED, NOT_FINISHED, WITH_RESULT, val2a, NOT_FAILED, null);
    respondOnSubscribe(mSrc2, ON_NEW_RESULT);

    DataSource<Object> dataSource = getAndSubscribe();
    DataSubscriber<Object> subscriber1 = verifyGetAndSubscribeM(mDataSourceSupplier1, mSrc1);
    DataSubscriber<Object> subscriber2 = verifyGetAndSubscribeM(mDataSourceSupplier2, mSrc2);

    verifySubscriber(dataSource, mSrc2, ON_NEW_RESULT);
    verifyState(dataSource, mSrc2, NOT_CLOSED, NOT_FINISHED, WITH_RESULT, val2a, NOT_FAILED, null);

    Object val2b = mock(Object.class);
    setState(mSrc2, NOT_CLOSED, FINISHED, WITH_RESULT, val2b, NOT_FAILED, null);
    subscriber2.onNewResult(mSrc2);
    verifySubscriber(dataSource, mSrc2, ON_NEW_RESULT);
    verifyState(dataSource, mSrc2, NOT_CLOSED, NOT_FINISHED, WITH_RESULT, val2b, NOT_FAILED, null);

    Object val = mock(Object.class);
    setState(mSrc1, NOT_CLOSED, FINISHED, WITH_RESULT, val, NOT_FAILED, null);
    subscriber1.onNewResult(mSrc1);
    mInOrder.verify(mSrc2).close();
    verifySubscriber(dataSource, mSrc1, ON_NEW_RESULT);
    verifyState(dataSource, mSrc1, NOT_CLOSED, FINISHED, WITH_RESULT, val, NOT_FAILED, null);

    testClose(dataSource, mSrc1);
    verifyState(dataSource, null, CLOSED, FINISHED, WITHOUT_RESULT, null, NOT_FAILED, null);
  }
Immediate result of low-res data source followed by delayed result of the first data source.
fbcore/src/test/java/com/facebook/datasource/IncreasingQualityDataSourceSupplierTest.java