if (getUser(newUsername) != null) {
throw new UserAlreadyExistsException(newUsername);
}
User user = getUser(oldUsername);
if (user == null) {
throw new UserNotFoundException(oldUsername);
}
String group = getGroup(user).getName();
if (group == null) {
throw new GroupNotFoundException(null);
}