Properties props = new Properties();
props.put(PROPERTY_KEY_USERNAME, keyUsername);
props.put(PROPERTY_KEY_PASSWORD, keyPassword);
props.put(PROPERTY_PASSWORD_HASHMETHOD, "sha1");
PasswordAuthenticationProcessor processor = new PasswordAuthenticationProcessor();
processor.updated(props);
byte[] hashedPw = DigestUtils.sha("secret");
// Test whether we can use the new properties...
User user = mock(User.class);
when(user.getName()).thenReturn("bob");
when(user.hasCredential(eq(keyPassword), eq(hashedPw))).thenReturn(Boolean.TRUE);
when(m_userAdmin.getUser(eq(keyUsername), eq("bob"))).thenReturn(user);
User result = processor.authenticate(m_userAdmin, "bob", "secret");
assert result != null : "Expected a valid user to be returned!";
assert "bob".equals(user.getName()) : "Expected bob to be returned!";
}