Class MockUserManagement

  • All Implemented Interfaces:
    UserManagement

    public class MockUserManagement
    extends java.lang.Object
    implements UserManagement
    Author:
    jonmv
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addToRoles​(UserId user, java.util.Collection<Role> roles)
      Ensures the given user exist, and are part of the given roles, or throws if the roles does not exist.
      void addUsers​(Role role, java.util.Collection<UserId> users)
      Ensures the given users exist, and are part of the given role, or throws if the role does not exist.
      void createRole​(Role role)
      Creates the given role, or throws if the role already exists.
      void deleteRole​(Role role)
      Ensures the given role does not exist.
      java.util.List<User> listUsers​(Role role)
      Returns all users in the given role, or throws if the role does not exist.
      void removeFromRoles​(UserId user, java.util.Collection<Role> roles)
      Ensures the given users are not part of the given role, or throws if the roles does not exist.
      void removeUsers​(Role role, java.util.Collection<UserId> users)
      Ensures none of the given users are part of the given role, or throws if the role does not exist.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MockUserManagement

        public MockUserManagement()
    • Method Detail

      • createRole

        public void createRole​(Role role)
        Description copied from interface: UserManagement
        Creates the given role, or throws if the role already exists.
        Specified by:
        createRole in interface UserManagement
      • addUsers

        public void addUsers​(Role role,
                             java.util.Collection<UserId> users)
        Description copied from interface: UserManagement
        Ensures the given users exist, and are part of the given role, or throws if the role does not exist.
        Specified by:
        addUsers in interface UserManagement
      • addToRoles

        public void addToRoles​(UserId user,
                               java.util.Collection<Role> roles)
        Description copied from interface: UserManagement
        Ensures the given user exist, and are part of the given roles, or throws if the roles does not exist.
        Specified by:
        addToRoles in interface UserManagement
      • removeUsers

        public void removeUsers​(Role role,
                                java.util.Collection<UserId> users)
        Description copied from interface: UserManagement
        Ensures none of the given users are part of the given role, or throws if the role does not exist.
        Specified by:
        removeUsers in interface UserManagement
      • removeFromRoles

        public void removeFromRoles​(UserId user,
                                    java.util.Collection<Role> roles)
        Description copied from interface: UserManagement
        Ensures the given users are not part of the given role, or throws if the roles does not exist.
        Specified by:
        removeFromRoles in interface UserManagement
      • listUsers

        public java.util.List<User> listUsers​(Role role)
        Description copied from interface: UserManagement
        Returns all users in the given role, or throws if the role does not exist.
        Specified by:
        listUsers in interface UserManagement