GoogleHelper { public static void updateUserFromGoogleUserinfoplus(Userinfoplus userinfo, User user) { User.Profile profile = new User.Profile(); profile.avatarURL = userinfo.getPicture(); profile.email = userinfo.getEmail(); profile.name = userinfo.getName(); profile.username = userinfo.getEmail(); user.setAvatarUrl(userinfo.getPicture()); Map<String, User.Profile> userProfile = user.getUserProfiles(); userProfile.put(TokenType.GOOGLE_COM.toString(), profile); } private  GoogleHelper(); static void setConfig(DockstoreWebserviceConfiguration config); static boolean updateGoogleUserData(String token, User user); static void updateUserFromGoogleUserinfoplus(Userinfoplus userinfo, User user); static Optional<String> getValidAccessToken(Token token); static Optional<Userinfoplus> userinfoplusFromToken(String token); static TokenResponse getTokenResponse(String googleClientID, String googleClientSecret, String code, String redirectUri);  }
@Test public void updateUserFromGoogleUserinfoplus() { String pictureUrl = "https: final String email = "jdoe@example.com"; final String username = "Jane Doe"; final User user = new User(); final Userinfoplus userinfoplus = Mockito.mock(Userinfoplus.class); when(userinfoplus.getPicture()).thenReturn(pictureUrl); when(userinfoplus.getEmail()).thenReturn(email); when(userinfoplus.getName()).thenReturn(username); GoogleHelper.updateUserFromGoogleUserinfoplus(userinfoplus, user); Assert.assertEquals(pictureUrl, user.getAvatarUrl()); final User.Profile profile = user.getUserProfiles().get(TokenType.GOOGLE_COM.toString()); Assert.assertEquals(email, profile.email); Assert.assertEquals(username, profile.name); Assert.assertEquals(pictureUrl, profile.avatarURL); }