// 6. switch back to admin
super.resetRestTemplate();
// 7. user password has not changed yet
UserService userService1 = super.setupCredentials(userService, UserService.class, userTO.getUsername(),
userMod.getPassword());
try {
userService1.readSelf();
fail("Credentials are not updated yet, thus request should raise AccessControlException");
} catch (AccessControlException e) {
assertNotNull(e);
}
resetRestTemplate();
// 8. actually update user
userTO = userService.update(userMod.getId(), userMod);
assertNotNull(userTO);
// 9. user password has now changed
UserService userService2 = super.setupCredentials(userService, UserService.class, userTO.getUsername(),
userMod.getPassword());
try {
UserTO user = userService2.readSelf();
assertNotNull(user);
} catch (AccessControlException e) {
fail("Credentials should be valid and not cause AccessControlException");
}
}