@Test public void whenDefaultGifsAreLoaded() { try { DB db = DBFactory.open(getTargetContext()); db.destroy(); } catch (Exception e) { Log.e("TEST", e.getLocalizedMessage(), e); } mHelper.dispatchFakeAppState(ImmutableAppState.builder().build()); mHelper.replacePersistenceMiddleware(new DataManager(getTargetContext())); GifActionCreator.getInstance().setDispatcher(mock(DispatcherImpl.class)); mActivityTestRule.launchActivity(new Intent()); Map<String, Gif> expectedGifs = getAppStateDefault().getGifs(); RecyclerTestLocker locker = new RecyclerTestLocker(getRecyclerView(), expectedGifs.size()); locker.waitForEspresso(); Map<Strings, Gif> gotGifs = ((GifsAdapter) getRecyclerView().getAdapter()).getGifs(); assertEquals(expectedGifs, gotGifs); GifActionCreator.getInstance().setDispatcher(getFluxxan().getDispatcher()); }