@Test public void testOnAccountConnect() { when(mAccountManager.getAccountsByType(TEST_ACCOUNT_TYPE)).thenReturn(new Account[]{}); mAccountController.onAccountConnect(mContext, mUser); verify(mEditor).putBoolean(PREF_MYTBA_ENABLED, true); verify(mEditor).putString(PREF_SELECTED_ACCOUNT, TEST_ACCOUNT_NAME); verify(mAccountManager).addAccountExplicitly(any(Account.class), eq(null), eq(null)); verify(mContext, times(2)).startService(any(Intent.class)); }
public void onAccountConnect(Context context, User user) { setMyTbaEnabled(true); registerSystemAccount(user.getEmail()); setSelectedAccount(user.getEmail()); registerForGcm(context); loadMyTbaData(context); }
AccountController { public void onAccountConnect(Context context, User user) { setMyTbaEnabled(true); registerSystemAccount(user.getEmail()); setSelectedAccount(user.getEmail()); registerForGcm(context); loadMyTbaData(context); } }
AccountController { public void onAccountConnect(Context context, User user) { setMyTbaEnabled(true); registerSystemAccount(user.getEmail()); setSelectedAccount(user.getEmail()); registerForGcm(context); loadMyTbaData(context); } @Inject  AccountController(
            SharedPreferences preferences,
            AccountManager accountManager,
            AppConfig appConfig,
            String accountType); }
AccountController { public void onAccountConnect(Context context, User user) { setMyTbaEnabled(true); registerSystemAccount(user.getEmail()); setSelectedAccount(user.getEmail()); registerForGcm(context); loadMyTbaData(context); } @Inject  AccountController(
            SharedPreferences preferences,
            AccountManager accountManager,
            AppConfig appConfig,
            String accountType); void setMyTbaEnabled(boolean enabled); boolean isMyTbaEnabled(); void setSelectedAccount(String account); String getSelectedAccount(); boolean isAccountSelected(); @Nullable Account getCurrentAccount(); void onAccountConnect(Context context, User user); String getWebClientId(); }
AccountController { public void onAccountConnect(Context context, User user) { setMyTbaEnabled(true); registerSystemAccount(user.getEmail()); setSelectedAccount(user.getEmail()); registerForGcm(context); loadMyTbaData(context); } @Inject  AccountController(
            SharedPreferences preferences,
            AccountManager accountManager,
            AppConfig appConfig,
            String accountType); void setMyTbaEnabled(boolean enabled); boolean isMyTbaEnabled(); void setSelectedAccount(String account); String getSelectedAccount(); boolean isAccountSelected(); @Nullable Account getCurrentAccount(); void onAccountConnect(Context context, User user); String getWebClientId();  }