### Question:
UserManager { public User createUser(String username, final String password, final String name, final String email) throws UserAlreadyExistsException { if (provider.isReadOnly()) { throw new UnsupportedOperationException("User provider is read-only."); } if (username == null || username.isEmpty()) { throw new IllegalArgumentException("Null or empty username."); } if (password == null || password.isEmpty()) { throw new IllegalArgumentException("Null or empty password."); } try { username = Stringprep.nodeprep(username); } catch (final StringprepException se) { throw new IllegalArgumentException("Invalid username: " + username, se); } if (provider.isNameRequired() && (name == null || name.matches("\\s*"))) { throw new IllegalArgumentException("Invalid or empty name specified with provider that requires name. User: " + username + " Name: " + name); } if (provider.isEmailRequired() && !StringUtils.isValidEmailAddress(email)) { throw new IllegalArgumentException("Invalid or empty email address specified with provider that requires email address. User: " + username + " Email: " + email); } final User user = provider.createUser(username, password, name, email); userCache.put(username, user); final Map<String,Object> params = Collections.emptyMap(); UserEventDispatcher.dispatchEvent(user, UserEventDispatcher.EventType.user_created, params); return user; } private  UserManager();   UserManager(final XMPPServer xmppServer); @SuppressWarnings("AccessStaticViaInstance") static UserProvider getUserProvider(); @SuppressWarnings("AccessStaticViaInstance") static UserPropertyProvider getUserPropertyProvider(); static UserManager getInstance(); User createUser(String username, final String password, final String name, final String email); void deleteUser(final User user); User getUser(String username); int getUserCount(); Collection<User> getUsers(); Collection<String> getUsernames(); Collection<User> getUsers(final int startIndex, final int numResults); Set<String> getSearchFields(); Collection<User> findUsers(final Set<String> fields, final String query); Collection<User> findUsers(final Set<String> fields, final String query, final int startIndex,
                                      final int numResults); boolean isRegisteredUser(final String username); boolean isRegisteredUser(final JID user); static void setProvider(UserProvider provider); void clearCaches(); static final SystemProperty<Class> USER_PROVIDER; static final SystemProperty<Class> USER_PROPERTY_PROVIDER; }### Answer:
@Test(expected=UserAlreadyExistsException.class) public void createExistingUserWillGetError() throws Exception{ userManager.createUser(USER_ID, "change me", "Test User Name", "test-email@example.com"); }