TwitterController { public void setAuthData(Map<String, String> authData) { if (authData == null) { twitter.setAuthToken(null); twitter.setAuthTokenSecret(null); twitter.setScreenName(null); twitter.setUserId(null); } else { twitter.setAuthToken(authData.get(AUTH_TOKEN_KEY)); twitter.setAuthTokenSecret(authData.get(AUTH_TOKEN_SECRET_KEY)); twitter.setUserId(authData.get(ID_KEY)); twitter.setScreenName(authData.get(SCREEN_NAME_KEY)); } } TwitterController();   TwitterController(Twitter twitter); void initialize(String consumerKey, String consumerSecret); Twitter getTwitter(); Task<Map<String, String>> authenticateAsync(Context context); Map<String, String> getAuthData(
            String userId,
            String screenName,
            String authToken,
            String authTokenSecret); void setAuthData(Map<String, String> authData);  }
@Test public void testSetAuthData() { TwitterController controller = new TwitterController(twitter); Map<String, String> authData = new HashMap<>(); authData.put("id", "test_id"); authData.put("screen_name", "test_screen_name"); authData.put("auth_token", "test_token"); authData.put("auth_token_secret", "test_secret"); controller.setAuthData(authData); verify(twitter).setUserId("test_id"); verify(twitter).setScreenName("test_screen_name"); verify(twitter).setAuthToken("test_token"); verify(twitter).setAuthTokenSecret("test_secret"); verifyNoMoreInteractions(twitter); }
@Test public void testSetAuthDataNull() { TwitterController controller = new TwitterController(twitter); controller.setAuthData(null); verify(twitter).setUserId(null); verify(twitter).setScreenName(null); verify(twitter).setAuthToken(null); verify(twitter).setAuthTokenSecret(null); verifyNoMoreInteractions(twitter); }