SettingsActivityPresenter implements PackageListAdapter.onPackageToggleListener { public void onSearch(final String query) { if (searchSubscription != null) searchSubscription.unsubscribe(); applicationInfoObservable = applicationsInfoStore.getInstalledApplications(query); updateSubscription(); } @Inject  SettingsActivityPresenter(Context context, SharedPreferences preferences,
      ApplicationsInfoStore applicationsInfoStore); SettingsActivityPresenter setView(SettingsView settingsView); void execute(); void onSearch(final String query); void onDestroy(); @Override void onPackageToggle(String packageName, boolean activated);  }
@Test public void testOnSearch() throws Exception { given(applicationsInfoStore.getInstalledApplications(mockString)).willReturn( Observable.just(applicationInfoList)); settingsActivityPresenter.onSearch(mockString); verify(settingsView).startProgressBar(); verify(settingsView).stopProgressBar(); verify(settingsView).updatePackageListAdapter(applicationInfoList); verify(applicationsInfoStore).getInstalledApplications(mockString); }