@Test public void findSelected() { addPages(2); mockStoreToSelect(pages.get(1)); assertEquals(pages.get(1), presenter.findSelected(pages)); }
@VisibleForTesting @NonNull Page findSelected(List<Page> visible) { final String selectedPageId = selectedPageStorage.getSelectedPage(); for (Page page : visible) { if (ObjectUtil.equals(selectedPageId, page.getId())) { return page; } } return visible.get(0); }
OverlayPresenter extends SimpleActivityLifecycleCallbacks implements ScreenTracker.ScreenListener { @VisibleForTesting @NonNull Page findSelected(List<Page> visible) { final String selectedPageId = selectedPageStorage.getSelectedPage(); for (Page page : visible) { if (ObjectUtil.equals(selectedPageId, page.getId())) { return page; } } return visible.get(0); } }
OverlayPresenter extends SimpleActivityLifecycleCallbacks implements ScreenTracker.ScreenListener { @VisibleForTesting @NonNull Page findSelected(List<Page> visible) { final String selectedPageId = selectedPageStorage.getSelectedPage(); for (Page page : visible) { if (ObjectUtil.equals(selectedPageId, page.getId())) { return page; } } return visible.get(0); } OverlayPresenter(
            OverlayView view,
            List<Page> allPages,
            SelectedPageStorage selectedPageStorage,
            ScreenTracker screenTracker,
            PhialNotifier notifier); }
OverlayPresenter extends SimpleActivityLifecycleCallbacks implements ScreenTracker.ScreenListener { @VisibleForTesting @NonNull Page findSelected(List<Page> visible) { final String selectedPageId = selectedPageStorage.getSelectedPage(); for (Page page : visible) { if (ObjectUtil.equals(selectedPageId, page.getId())) { return page; } } return visible.get(0); } OverlayPresenter(
            OverlayView view,
            List<Page> allPages,
            SelectedPageStorage selectedPageStorage,
            ScreenTracker screenTracker,
            PhialNotifier notifier); @Override void onActivityStarted(Activity activity); @Override void onActivityStopped(Activity activity); @Override void onActivityResumed(Activity activity); @Override void onActivityPaused(Activity activity); @Override void onScreenChanged(Screen screen); @Nullable View findViewById(int id); void destroy(); }
OverlayPresenter extends SimpleActivityLifecycleCallbacks implements ScreenTracker.ScreenListener { @VisibleForTesting @NonNull Page findSelected(List<Page> visible) { final String selectedPageId = selectedPageStorage.getSelectedPage(); for (Page page : visible) { if (ObjectUtil.equals(selectedPageId, page.getId())) { return page; } } return visible.get(0); } OverlayPresenter(
            OverlayView view,
            List<Page> allPages,
            SelectedPageStorage selectedPageStorage,
            ScreenTracker screenTracker,
            PhialNotifier notifier); @Override void onActivityStarted(Activity activity); @Override void onActivityStopped(Activity activity); @Override void onActivityResumed(Activity activity); @Override void onActivityPaused(Activity activity); @Override void onScreenChanged(Screen screen); @Nullable View findViewById(int id); void destroy();  }