### Question:
UserIdentityParser { public UserPrincipalImpl parseUser() { return UserPrincipalImpl.newUser().withEmail(parseEmail()).withFirstName(parseFirstName()) .withLastName(parseLastName()).withUsername(parseUsername()) .withRoles(parseRoles()).withIdentityToken(credential.getIdentityToken()) .withAccessToken(credential.getAccessToken()) .withRefreshToken(credential.getRefreshToken()).build(); } UserIdentityParser(final OIDCCredentials credential,
                    final KeycloakConfiguration keycloakConfiguration); UserPrincipalImpl parseUser();  }### Answer:
@Test public void testParsers_WithCredentials() { String expectedUsername = "user1"; String expectedEmail = "user1@feedhenry.org"; UserRole expectedRealmRole = new UserRole("mobile-user", RoleType.REALM, null); UserRole expectedResourceRole = new UserRole("ios-access", RoleType.RESOURCE, "client-app"); UserPrincipal user = parser.parseUser(); String actualUsername = user.getUsername(); String actualEmail = user.getEmail(); Set<UserRole> actualRoles = user.getRoles(); Set<UserRole> realmRoles = user.getRealmRoles(); Set<UserRole> resourceRoles = user.getResourceRoles(); assertEquals(expectedUsername, actualUsername); assertEquals(expectedEmail, actualEmail); assertEquals(1, realmRoles.size()); assertEquals(1, resourceRoles.size()); assertTrue(actualRoles.contains(expectedRealmRole)); assertTrue(actualRoles.contains(expectedResourceRole)); }