InstanceUploaderListActivity extends InstanceListActivity implements
        OnLongClickListener, DiskSyncListener, AdapterView.OnItemClickListener, LoaderManager.LoaderCallbacks<Cursor> { @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.menu_preferences: createPreferencesMenu(); return true; case R.id.menu_change_view: showSentAndUnsentChoices(); return true; case R.id.menu_filter: return true; case android.R.id.home: super.onBackPressed(); break; } return super.onOptionsItemSelected(item); }  @Override void onCreate(Bundle savedInstanceState); @OnClick({R.id.upload_button, R.id.sms_upload_button}) void onUploadButtonsClicked(Button button); @Override void syncComplete(@NonNull String result); @Override boolean onCreateOptionsMenu(Menu menu); @Override boolean onOptionsItemSelected(MenuItem item); @Override void onItemClick(AdapterView<?> parent, View view, int position, long rowId); @NonNull @Override Loader<Cursor> onCreateLoader(int id, Bundle args); @Override void onLoadFinished(@NonNull Loader<Cursor> loader, Cursor cursor); @Override void onLoaderReset(@NonNull Loader<Cursor> loader); @Override boolean onLongClick(View v); static final int INSTANCE_UPLOADER; public boolean showAllMode; }
@Test public void clickingChangeView_thenClickingShowAll_sendsAnalyticsEvent() { InstanceUploaderListActivity activity = Robolectric.setupActivity(InstanceUploaderListActivity.class); activity.onOptionsItemSelected(new RoboMenuItem(R.id.menu_change_view)); AlertDialog dialog = ShadowAlertDialog.getLatestAlertDialog(); shadowOf(dialog).clickOnItem(1); verify(analytics).logEvent("FilterSendForms", "SentAndUnsent"); }