Promise { @NonNull public abstract ActionHandle then(@NonNull ResultListener<R> listener);  abstract void thenNothing(); @NonNull abstract ActionHandle then(@NonNull ResultListener<R> listener); @NonNull abstract ActionHandle then(@NonNull ActorThread thread, @NonNull ResultListener<R> listener); @Nullable abstract R get(); @NonNull static Promise<R> wrap(@Nullable R result); @NonNull static Promise<R> wrap(@Nullable R result, @Nullable ResourceCleaner<R> cleaner); @NonNull static TestPromise<R> test(@Nullable R result); @NonNull static Promise<R> wrap(@NonNull MessageSender sender, @NonNull T message);  }
@Test public void verifyThen_true_callThen() { TestPromise<Object> promise = new TestPromise<>(mResult); promise.then(mListener); Assert.assertTrue(promise.verifyThen()); }
@Test public void then_resultIsTheSame_callThen() { TestPromise<Object> promise = new TestPromise<>(mResult); promise.then(mListener); Mockito.verify(mListener).onResult(mResult); }
@Test public void verifyThen_false_afterReset() { TestPromise<Object> promise = new TestPromise<>(mResult); promise.then(mListener); promise.reset(); Assert.assertFalse(promise.verifyThen()); }
@Test public void verifyThen_doesNotIntersect_callThen() { TestPromise<Object> promise = new TestPromise<>(mResult); promise.then(mListener); Assert.assertFalse(promise.verifyThenNothing()); Assert.assertFalse(promise.verifyThenWithThread()); Assert.assertFalse(promise.verifyForget()); Assert.assertFalse(promise.verifyGet()); }
@Test public void verifyThenWithThread_true_callThen() { TestPromise<Object> promise = new TestPromise<>(mResult); promise.then(mThread, mListener); Assert.assertTrue(promise.verifyThenWithThread()); }
@Test public void then_resultIsTheSame_callThenWithThread() { TestPromise<Object> promise = new TestPromise<>(mResult); promise.then(mThread, mListener); Mockito.verify(mListener).onResult(mResult); }
@Test public void verifyThenWithThread_false_afterReset() { TestPromise<Object> promise = new TestPromise<>(mResult); promise.then(mThread, mListener); promise.reset(); Assert.assertFalse(promise.verifyThenWithThread()); }
@Test public void verifyThenWithThread_doesNotIntersect_callThenWithThread() { TestPromise<Object> promise = new TestPromise<>(mResult); promise.then(mThread, mListener); Assert.assertFalse(promise.verifyThen()); Assert.assertFalse(promise.verifyThenNothing()); Assert.assertFalse(promise.verifyForget()); Assert.assertFalse(promise.verifyGet()); }
@Test public void verifyGet_false_afterReset() { TestPromise<Object> promise = new TestPromise<>(mResult); promise.then(mThread, mListener); promise.reset(); Assert.assertFalse(promise.verifyGet()); }