* @param username the username
* @return the user
* @throws CouldNotLoadException the could not load exception
*/
public static User userFromName(String username) throws CouldNotLoadException{
UserSearch us = UserSearch.search(username.toLowerCase());
if (us.getResponse().getResults() != null && !us.getResponse().getResults().isEmpty()){
return fromId(us.getResponse().getResults().get(0).getUserId().intValue());
}
else {
throw new CouldNotLoadException("User not found");
}
}