SecurityContext.executeWithSystemPermissions(new Callable<Object>() {
@Override
public Object call() throws Exception {
authenticationContext.login("admin", new Password("password"));
User user = new User(userName);
Attribute attr = new Attribute();
attr.setAttributeName(attrName);
attr.getValues().add(attrValue);
attr.generateUuid(user.getUsername());
user.getAttributes().add(attr);
impl.checkinUser(user);
// Assert userManager-Content
assertTrue(userManager.getUserList().contains(userName));
assertTrue(userManager.getUserAttribute(userName, attrName).get(0).equals(attrValue));
assertTrue(userManager.getUserCredentials(userName, credType).equals(credValue));
List<User> result = queryService.queryByString(User.class, "username:\"" + user.getUsername() + "\"");
// Assert DB-Result
assertEqualUser(user, result.get(0));
return null;