Search in sources :

Example 11 with PreparedOperation

use of com.pushtorefresh.storio3.operations.PreparedOperation in project storio by pushtorefresh.

the class ChainImplTest method buildChain_placesRealInterceptorAfterRegistered.

@Test
public void buildChain_placesRealInterceptorAfterRegistered() {
    Interceptor registered1 = spy(new IntermediateInterceptor());
    Interceptor registered2 = spy(new IntermediateInterceptor());
    final List<Interceptor> interceptors = Arrays.asList(registered1, registered2);
    Interceptor real = mock(Interceptor.class);
    final Chain chain = ChainImpl.buildChain(interceptors, real);
    InOrder inOrder = Mockito.inOrder(registered1, registered2, real);
    PreparedOperation operation = mock(PreparedOperation.class);
    chain.proceed(operation);
    inOrder.verify(registered1).intercept(eq(operation), any(Chain.class));
    inOrder.verify(registered2).intercept(eq(operation), any(Chain.class));
    inOrder.verify(real).intercept(eq(operation), any(Chain.class));
}
Also used : Chain(com.pushtorefresh.storio3.Interceptor.Chain) InOrder(org.mockito.InOrder) PreparedOperation(com.pushtorefresh.storio3.operations.PreparedOperation) Interceptor(com.pushtorefresh.storio3.Interceptor) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)9 PreparedOperation (com.pushtorefresh.storio3.operations.PreparedOperation)5 TestObserver (io.reactivex.observers.TestObserver)5 StorIOException (com.pushtorefresh.storio3.StorIOException)4 Interceptor (com.pushtorefresh.storio3.Interceptor)3 Chain (com.pushtorefresh.storio3.Interceptor.Chain)2 PreparedCompletableOperation (com.pushtorefresh.storio3.operations.PreparedCompletableOperation)2 BackpressureStrategy (io.reactivex.BackpressureStrategy)2 Completable (io.reactivex.Completable)2 Nullable (android.support.annotation.Nullable)1 Optional (com.pushtorefresh.storio3.Optional)1 InOrder (org.mockito.InOrder)1 Config (org.robolectric.annotation.Config)1