MainActivity extends SpotifyAbstractActivity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); settings = getSettings(); spotifyHelper = getSpotifyHelper(); if (settings.spotifyAccount.getAuthToken() == null) { Intent intent = new Intent(this, SpotifyOAuthActivity.class); startActivity(intent); finish(); } else { if (spotifyHelper.isAuthTokenValid()) { setContentView(R.layout.main); } else { loadingAuthToken = initProgressDialog(this); loadingAuthToken.show(); waitForAuthToken(); } } }  @Override void onCreate(Bundle savedInstanceState); @Override void onStart(); void waitForAuthToken(); SpotifyHelper getSpotifyHelper();  }
@Test public void test_onCreate_noAuth() { doReturn(null).when(account).getAuthToken(); getActivity().onCreate(null); verify(getActivity()).startActivity(any(Intent.class)); verify(getActivity()).finish(); }