### Question:
OverlayPresenter extends SimpleActivityLifecycleCallbacks implements ScreenTracker.ScreenListener { @VisibleForTesting @NonNull List<Page> calcVisiblePages() { final List<Page> visiblePages = new ArrayList<>(allPages.size()); for (Page page : allPages) { final boolean shouldShowPage = screenTracker.matchesAny(page.getTargetScreens()); if (shouldShowPage) { visiblePages.add(page); } } return visiblePages; } 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();  }### Answer:
@Test public void calcVisiblePages() throws Exception { addPages(2); when(screenTracker.matchesAny(any())).thenReturn(true, false); assertEquals(Collections.singletonList(pages.get(0)), presenter.calcVisiblePages()); }