public class

MockUser

extends Object
implements UserWithAttributes Serializable
java.lang.Object
   ↳ com.atlassian.jira.user.MockUser

Class Overview

A convenient mock for User that supplies reasonable behaviour for unit tests. Note that creating a MockUser does not automatically ensure that it can be resolved by the UserManager or UserKeyService, so unit tests may need to provide mocks for one or both of those services as well.

Summary

Constants
long MOCK_DIRECTORY_ID
Public Constructors
MockUser(String username)
Convenience constructor that is equivalent to MockUser(username, "", null, null).
MockUser(String username, long directoryId)
Convenience constructor that is equivalent to MockUser(username, "", null, directoryId).
MockUser(String username, String fullName, String email)
Convenience constructor that is equivalent to MockUser(username, fullName, email, null).
MockUser(String username, String fullName, String email, long directoryId)
MockUser(String username, String fullName, String email, Map<StringSet<String>> values)
Creates a new mock user with the specified information.
Public Methods
int compareTo(User other)
boolean equals(Object o)
long getDirectoryId()
String getDisplayName()
String getEmailAddress()
Set<String> getKeys()
String getName()
String getValue(String key)
Set<String> getValues(String key)
int hashCode()
boolean isActive()
A MockUser is always active by default.
boolean isEmpty()
MockUser setActive(boolean active)
void setDirectoryId(long id)
String toString()
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.crowd.embedded.api.Attributes
From interface com.atlassian.crowd.embedded.api.User
From interface java.lang.Comparable
From interface java.security.Principal

Constants

public static final long MOCK_DIRECTORY_ID

Constant Value: 1 (0x0000000000000001)

Public Constructors

public MockUser (String username)

Convenience constructor that is equivalent to MockUser(username, "", null, null).

public MockUser (String username, long directoryId)

Convenience constructor that is equivalent to MockUser(username, "", null, directoryId).

public MockUser (String username, String fullName, String email)

Convenience constructor that is equivalent to MockUser(username, fullName, email, null).

public MockUser (String username, String fullName, String email, long directoryId)

public MockUser (String username, String fullName, String email, Map<StringSet<String>> values)

Creates a new mock user with the specified information.

Parameters
username the value to be returned for getName()
fullName the value to be returned for getDisplayName()
email the value to be returned for getEmailAddress()
values a map to provide user attributes, such as are returned by getKeys() and getValues(String). May be null, in which case an empty map is used.

Public Methods

public int compareTo (User other)

public boolean equals (Object o)

public long getDirectoryId ()

public String getDisplayName ()

public String getEmailAddress ()

public Set<String> getKeys ()

public String getName ()

public String getValue (String key)

public Set<String> getValues (String key)

public int hashCode ()

public boolean isActive ()

A MockUser is always active by default.

public boolean isEmpty ()

public MockUser setActive (boolean active)

public void setDirectoryId (long id)

public String toString ()