OadrSecurityRoleService { public User grantDigestRole(String username, String password) { AbstractUser abstractUser = saveFindUser(username); if (!abstractUser.getDigestPassword().equals(password)) { throw new BadCredentialsException("Bad credentials given for user: '" + username + "'"); } return this.grantRole(abstractUser, abstractUser.getDigestPassword()); }  User digestUserDetail(String username); User grantDigestRole(String username, String password); User grantBasicRole(String username, CharSequence rawPassword); User grantX509Role(String username);  }
@Test public void grantDigestRoleTest() { String encodeDigest = oadrUserService.encodeDigest("passUser", "passUser", digestAuthenticationProvider.getRealm()); User digestUserDetail = oadrSecurityRoleService.digestUserDetail("passUser"); assertEquals(digestUserDetail.getPassword(), encodeDigest); User grantDigestRole = oadrSecurityRoleService.grantDigestRole("passUser", encodeDigest); assertEquals(grantDigestRole.getPassword(), encodeDigest); boolean exception = false; try { oadrSecurityRoleService.grantDigestRole("passUser", "passUser"); } catch (Exception e) { exception = true; } assertTrue(exception); }