LoginActivity extends AccountAuthenticatorActionBarActivity implements
        LoginUrlFragment.OnFragmentInteractionListener,
        LoginFragment.OnFragmentInteractionListener { @Override public void onBackPressed() { if (getSupportFragmentManager().getBackStackEntryCount() > 0) { getSupportFragmentManager().popBackStack(); return; } super.onBackPressed(); }  @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 shouldFinishActivityWhenBackPressed() { loginActivity.onBackPressed(); assertThat(loginActivity.isFinishing(), is(true)); }