@@ -0,0 +1,2684 @@
+package com.turlir.abakgists.allgists;%0A%0Aimport android.os.Build;%0A%0Aimport com.turlir.abakgists.BuildConfig;%0Aimport com.turlir.abakgists.DatabaseMocking;%0Aimport com.turlir.abakgists.api.ApiClient;%0Aimport com.turlir.abakgists.api.Repository;%0Aimport com.turlir.abakgists.di.AppComponent;%0Aimport com.turlir.abakgists.model.GistModel;%0A%0Aimport org.junit.Before;%0Aimport org.junit.BeforeClass;%0Aimport org.junit.Rule;%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0Aimport org.mockito.Mock;%0Aimport org.robolectric.RobolectricTestRunner;%0Aimport org.robolectric.annotation.Config;%0A%0Aimport java.util.List;%0A%0Aimport it.cosenonjaviste.daggermock.DaggerMockRule;%0Aimport it.cosenonjaviste.daggermock.InjectFromComponent;%0Aimport rx.Observable;%0Aimport rx.Scheduler;%0Aimport rx.android.plugins.RxAndroidPlugins;%0Aimport rx.android.plugins.RxAndroidSchedulersHook;%0Aimport rx.functions.Func1;%0Aimport rx.observers.TestSubscriber;%0Aimport rx.plugins.RxJavaHooks;%0Aimport rx.schedulers.Schedulers;%0A%0Aimport static org.junit.Assert.assertEquals;%0Aimport static org.junit.Assert.assertNotNull;%0A%0A@RunWith(RobolectricTestRunner.class)%0A@Config(constants = BuildConfig.class, sdk = Build.VERSION_CODES.LOLLIPOP, packageName = %22com.turlir.abakgists%22)%0Apublic class ModelRequesterTest %7B%0A%0A    @Rule%0A    public final DaggerMockRule%3CAppComponent%3E rule = new DatabaseMocking();%0A%0A    @InjectFromComponent%0A    private Repository _repo;%0A%0A    @Mock%0A    private ApiClient _client;%0A%0A    private ModelRequester mRequester;%0A%0A    @BeforeClass%0A    public static void setupRx() %7B%0A        RxJavaHooks.reset();%0A        RxAndroidPlugins.getInstance().reset();%0A%0A        RxJavaHooks.setOnIOScheduler(new Func1%3CScheduler, Scheduler%3E() %7B%0A            @Override%0A            public Scheduler call(Scheduler scheduler) %7B%0A                return Schedulers.immediate();%0A            %7D%0A        %7D);%0A        RxAndroidPlugins.getInstance().registerSchedulersHook(new RxAndroidSchedulersHook() %7B%0A            @Override%0A            public Scheduler getMainThreadScheduler() %7B%0A                return Schedulers.immediate();%0A            %7D%0A        %7D);%0A    %7D%0A%0A    @Before%0A    public void setup() %7B%0A        mRequester = new ModelRequester(_repo);%0A        assertNotNull(mRequester);%0A    %7D%0A%0A    @Test%0A    public void successFromCache() %7B%0A        Observable%3CList%3CGistModel%3E%3E obs = mRequester.request(0);%0A        TestSubscriber%3CList%3CGistModel%3E%3E subscriber = new TestSubscriber%3C%3E();%0A        obs.subscribe(subscriber);%0A%0A        subscriber.assertValueCount(1);%0A        subscriber.assertNotCompleted();%0A        List%3CList%3CGistModel%3E%3E events = subscriber.getOnNextEvents();%0A        List%3CGistModel%3E first = events.get(0);%0A        assertEquals(1, first.size());%0A    %7D%0A%0A%7D

add ModelRequesterTest