Package com.atlassian.jira.user
Class MockApplicationUser
java.lang.Object
com.atlassian.jira.user.MockApplicationUser
- All Implemented Interfaces:
WithId,WithKey,ApplicationUser,Serializable,Principal
A convenient mock for
ApplicationUser.- Since:
- v6.0
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsFields inherited from interface com.atlassian.jira.entity.WithId
ID_COMPARATOR -
Constructor Summary
ConstructorsConstructorDescriptionMockApplicationUser(String username) Uses thelowercaseform of the suppliedusernameas the key.MockApplicationUser(String username, long directoryId) MockApplicationUser(String userKey, com.atlassian.crowd.embedded.api.User user) MockApplicationUser(String userKey, String username) Uses the given key as-is.MockApplicationUser(String username, String displayName, String email) Uses thelowercaseform of the suppliedusernameas the key.MockApplicationUser(String userKey, String username, String displayName, String email) Uses the given key as-is. -
Method Summary
Modifier and TypeMethodDescriptionbooleanImplementations must ensure equality based on getKey().longcom.atlassian.crowd.embedded.api.UserReturns the display name of the user.getId()getKey()Returns the key which distinguishes the ApplicationUser as unique.getName()Synonym forApplicationUser.getUsername()and implementation ofPrincipal.getName().inthashCode()Implementations must produce a hashcode based on getKey().booleanisActive()AMockUseris always active by default.static MockApplicationUser.BuildersetActive(boolean active) toString()
-
Field Details
-
SEQUENCE
-
FAKE_USER_DIRECTORY_ID
public static final long FAKE_USER_DIRECTORY_ID- See Also:
-
-
Constructor Details
-
MockApplicationUser
Uses thelowercaseform of the suppliedusernameas the key.- Parameters:
username- as forMockUser(String)
-
MockApplicationUser
-
MockApplicationUser
Uses thelowercaseform of the suppliedusernameas the key.- Parameters:
username- as forMockUser(String, String, String)displayName- as forMockUser(String, String, String)email- as forMockUser(String, String, String)
-
MockApplicationUser
Uses the given key as-is.- Parameters:
userKey- desired user's Key, the value to be returned forApplicationUser.getKey()username- as forMockUser(String)
-
MockApplicationUser
Uses the given key as-is.- Parameters:
userKey- desired user's Key, the value to be returned forApplicationUser.getKey()username- as forMockUser(String, String, String)displayName- as forMockUser(String, String, String)email- as forMockUser(String, String, String)
-
MockApplicationUser
-
-
Method Details
-
newBuilder
-
isActive
public boolean isActive()AMockUseris always active by default.- Specified by:
isActivein interfaceApplicationUser- Returns:
trueif this user is active.
-
setActive
-
getKey
Description copied from interface:ApplicationUserReturns the key which distinguishes the ApplicationUser as unique. The same key is shared by allUsers with the same username (ignoring case) across all user directories.- Specified by:
getKeyin interfaceApplicationUser- Specified by:
getKeyin interfaceWithKey- Returns:
- the key which distinguishes the ApplicationUser as unique
-
getEmailAddress
- Specified by:
getEmailAddressin interfaceApplicationUser- Returns:
- email address of the user.
-
getDisplayName
Description copied from interface:ApplicationUserReturns the display name of the user. This is sometimes referred to as "full name".- Specified by:
getDisplayNamein interfaceApplicationUser- Returns:
- display name of the user, must never be null.
-
getDirectoryUser
public com.atlassian.crowd.embedded.api.User getDirectoryUser()- Specified by:
getDirectoryUserin interfaceApplicationUser- Returns:
- the user as seen by the particular user directory that this User is defined in.
-
getUsername
- Specified by:
getUsernamein interfaceApplicationUser- Returns:
- the username (login) of the user; must never be
null. - See Also:
-
getName
Description copied from interface:ApplicationUserSynonym forApplicationUser.getUsername()and implementation ofPrincipal.getName().- Specified by:
getNamein interfaceApplicationUser- Specified by:
getNamein interfacePrincipal- Returns:
- the username (login) of the user; must never be
null. - See Also:
-
getDirectoryId
public long getDirectoryId()- Specified by:
getDirectoryIdin interfaceApplicationUser- Returns:
- the ID of the user directory that this user comes from.
-
equals
Description copied from interface:ApplicationUserImplementations must ensure equality based on getKey(). -
hashCode
public int hashCode()Description copied from interface:ApplicationUserImplementations must produce a hashcode based on getKey(). -
toString
-
getId
-