Search in sources :

Example 16 with Reply

use of io.rx_cache2.Reply in project RxCache by VictorAlbertos.

the class ProvidersDynamicsKeysRxCacheTest method Pagination_With_Evict_Cache_By_Page.

@Test
public void Pagination_With_Evict_Cache_By_Page() {
    TestObserver<Reply<List<io.rx_cache2.internal.Mock>>> observer;
    observer = providersRxCache.getMocksDynamicKeyEvictPage(Observable.just(createMocks(SIZE)), new DynamicKey(1), new EvictDynamicKey(true)).test();
    observer.awaitTerminalEvent();
    observer = providersRxCache.getMocksDynamicKeyEvictPage(Observable.just(createMocks(SIZE)), new DynamicKey(2), new EvictDynamicKey(true)).test();
    observer.awaitTerminalEvent();
    observer = providersRxCache.getMocksDynamicKeyEvictPage(ProviderHelper.<List<io.rx_cache2.internal.Mock>>withoutLoader(), new DynamicKey(1), new EvictDynamicKey(true)).test();
    observer.awaitTerminalEvent();
    assertThat(observer.errors().size(), is(1));
    assertThat(observer.values().size(), is(0));
    observer = providersRxCache.getMocksDynamicKeyEvictPage(ProviderHelper.<List<io.rx_cache2.internal.Mock>>withoutLoader(), new DynamicKey(2), new EvictDynamicKey(false)).test();
    observer.awaitTerminalEvent();
    assertThat(observer.errors().size(), is(0));
    assertThat(observer.values().size(), is(1));
}
Also used : EvictDynamicKey(io.rx_cache2.EvictDynamicKey) Reply(io.rx_cache2.Reply) EvictDynamicKey(io.rx_cache2.EvictDynamicKey) DynamicKey(io.rx_cache2.DynamicKey) Test(org.junit.Test)

Aggregations

Reply (io.rx_cache2.Reply)16 Function (io.reactivex.functions.Function)9 FavoriteException (com.dante.exception.FavoriteException)7 MessageException (com.dante.exception.MessageException)7 EvictDynamicKey (io.rx_cache2.EvictDynamicKey)7 Test (org.junit.Test)7 BaseResult (com.dante.data.model.BaseResult)6 DynamicKeyGroup (io.rx_cache2.DynamicKeyGroup)6 EvictDynamicKeyGroup (io.rx_cache2.EvictDynamicKeyGroup)6 UnLimit91PornItem (com.dante.data.model.UnLimit91PornItem)4 TypeToken (com.google.gson.reflect.TypeToken)3 TestObserver (io.reactivex.observers.TestObserver)3 DynamicKey (io.rx_cache2.DynamicKey)3 BaseTest (io.rx_cache2.internal.common.BaseTest)3 Type (java.lang.reflect.Type)3 MeiZiTu (com.dante.data.model.MeiZiTu)1 Mm99 (com.dante.data.model.Mm99)1 PigAvVideo (com.dante.data.model.PigAvVideo)1 VideoResult (com.dante.data.model.VideoResult)1 ParseMeiZiTu (com.dante.parser.ParseMeiZiTu)1