### Question:
OidcHelper extends AbstractService { public UserDetails getOidcUser(String accessToken) throws ApsSystemException { String[] split_string = accessToken.split("\\."); String base64EncodedBody = split_string[1]; Base64 base64Url = new Base64(true); logger.info("---------------------TOKEN-----------------------"); logger.info(new String(base64Url.decode(split_string[0]))); logger.info("--------------------------------------------"); String body = new String(base64Url.decode(base64EncodedBody)); logger.info(body); logger.info("--------------------------------------------"); JSONObject obj = new JSONObject(body); String username = null; if (obj.has(USERNAME_PARAM_NAME)) { username = obj.getString(USERNAME_PARAM_NAME); logger.info("USERNAME -> " + username); } else { username = "tempUser"; logger.info("\"" + USERNAME_PARAM_NAME + "\" ATTRIBUTE NOT FOUND"); logger.info("DEFAULT USERNAME -> " + username); } if (StringUtils.isEmpty(username)) { username = "tempUser"; logger.info("\"" + USERNAME_PARAM_NAME + "\" ATTRIBUTE EMPTY OR NOT FOUND"); logger.info("DEFAULT USERNAME -> " + username); } UserDetails user = authenticationProviderManager.getUser(username); if (null == user) { logger.info("CREATING UserDetails object for " + username); user = new User(); ((User) user).setUsername(username); ((User) user).setPassword(RESERVED_PASSWORD); UserProfile profile = new UserProfile(); ((User) user).setProfile(profile); copyAttributes(obj, profile); }else{ logger.info("WARNING!!! UserDetails object found for " + username); } return user; }  String buildOauthRequestString(HttpServletRequest req); UserDetails getOidcUser(String accessToken); @Override void init(); boolean isOidcActive(); OAuthClientRequest buildOauthRequest(HttpServletRequest request, String code);  }### Answer:
@Test public void testHasIdentityProvider() throws ApsSystemException { when(authenticationProviderManager.getUser(anyString())).thenReturn(null); UserDetails oidcUser = oidcUserExtractor.getOidcUser(SAMPLE_TOKEN); assertThat(oidcUser.getUsername(), is(equalTo("entando_test_1"))); UserProfile userProfile = (UserProfile) oidcUser.getProfile(); assertThat((String)userProfile.getValue("fname"), is(equalTo("Benjamin"))); assertThat((String)userProfile.getValue("lname"), is(equalTo("Berg"))); }