AppsPresenter { public void filterApps(String text) { appsActivity.showApps(sort(filter(text))); } AppsPresenter(AppsActivity appsActivity, AppsProvider appsProvider); void showAllApps(); void filterApps(String text);  }
@Test public void should_filter_apps() throws Exception { when(appsProvider.findInstalledApps()).thenReturn(Arrays.asList(new App("BBB"), new App("AAA"), new App("ABB"))); appsPresenter.filterApps("A"); verify(activity).showApps(Arrays.asList(new App("AAA"), new App("ABB"))); }