LoginActivity extends AccountAuthenticatorActionBarActivity implements
        LoginUrlFragment.OnFragmentInteractionListener,
        LoginFragment.OnFragmentInteractionListener { @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: onBackPressed(); return true; } return super.onOptionsItemSelected(item); }  @Override boolean onOptionsItemSelected(MenuItem item); @Override void onBackPressed(); @Override void onValidUrl(String blogUrl); @Override void onSuccess(String email, String password, Token token, User user);  }
@Test public void shouldFinishActivityWhenHomePressed() { MenuItem item = new RoboMenuItem(android.R.id.home); loginActivity.onOptionsItemSelected(item); assertThat(loginActivity.isFinishing(), is(true)); }