final Map<String, Object> childAttrs = new HashMap<String, Object>();
childAttrs.put(User.NAME, getTestName());
childAttrs.put(User.PASSWORD, "password");
User user = _authManager.addChild(User.class, childAttrs);
assertNotNull("User should be created but addChild returned null", user);
assertEquals(getTestName(), user.getName());
if(!isPlain())
{
// password shouldn't actually be the given string, but instead hashed value
assertFalse("Password shouldn't actually be the given string, but instead hashed value",
"password".equals(user.getPassword()));
}
AuthenticationResult authResult =
_authManager.authenticate(getTestName(), "password");
assertEquals("User should authenticate with given password", AuthenticationResult.AuthenticationStatus.SUCCESS, authResult.getStatus());
assertEquals("Manager should have exactly one user child",1, _authManager.getChildren(User.class).size());
assertEquals("Manager should have exactly one user child",1, _authManager.getUsers().size());
user.delete();
assertEquals("No users should be present after child deletion", 0, _authManager.getChildren(User.class).size());
authResult = _authManager.authenticate(getTestName(), "password");