@Test(expected=IllegalArgumentException.class) public void deleteInvalidUserWillGetError() throws Exception{ User user = new User("!@#ED",null,null,null,null); userManager.deleteUser(user); }
public void deleteUser(final User user) { if (provider.isReadOnly()) { throw new UnsupportedOperationException("User provider is read-only."); } final String username = user.getUsername(); try { Stringprep.nodeprep(username); } catch (final StringprepException se) { throw new IllegalArgumentException("Invalid username: " + username, se); } final Map<String,Object> params = Collections.emptyMap(); UserEventDispatcher.dispatchEvent(user, UserEventDispatcher.EventType.user_deleting, params); provider.deleteUser(user.getUsername()); userCache.remove(user.getUsername()); }
UserManager { public void deleteUser(final User user) { if (provider.isReadOnly()) { throw new UnsupportedOperationException("User provider is read-only."); } final String username = user.getUsername(); try { Stringprep.nodeprep(username); } catch (final StringprepException se) { throw new IllegalArgumentException("Invalid username: " + username, se); } final Map<String,Object> params = Collections.emptyMap(); UserEventDispatcher.dispatchEvent(user, UserEventDispatcher.EventType.user_deleting, params); provider.deleteUser(user.getUsername()); userCache.remove(user.getUsername()); } }
UserManager { public void deleteUser(final User user) { if (provider.isReadOnly()) { throw new UnsupportedOperationException("User provider is read-only."); } final String username = user.getUsername(); try { Stringprep.nodeprep(username); } catch (final StringprepException se) { throw new IllegalArgumentException("Invalid username: " + username, se); } final Map<String,Object> params = Collections.emptyMap(); UserEventDispatcher.dispatchEvent(user, UserEventDispatcher.EventType.user_deleting, params); provider.deleteUser(user.getUsername()); userCache.remove(user.getUsername()); } private  UserManager();   UserManager(final XMPPServer xmppServer); }
UserManager { public void deleteUser(final User user) { if (provider.isReadOnly()) { throw new UnsupportedOperationException("User provider is read-only."); } final String username = user.getUsername(); try { Stringprep.nodeprep(username); } catch (final StringprepException se) { throw new IllegalArgumentException("Invalid username: " + username, se); } final Map<String,Object> params = Collections.emptyMap(); UserEventDispatcher.dispatchEvent(user, UserEventDispatcher.EventType.user_deleting, params); provider.deleteUser(user.getUsername()); userCache.remove(user.getUsername()); } 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(); }
UserManager { public void deleteUser(final User user) { if (provider.isReadOnly()) { throw new UnsupportedOperationException("User provider is read-only."); } final String username = user.getUsername(); try { Stringprep.nodeprep(username); } catch (final StringprepException se) { throw new IllegalArgumentException("Invalid username: " + username, se); } final Map<String,Object> params = Collections.emptyMap(); UserEventDispatcher.dispatchEvent(user, UserEventDispatcher.EventType.user_deleting, params); provider.deleteUser(user.getUsername()); userCache.remove(user.getUsername()); } 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; }