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

Public Constructors
MockUser(String username)
Convenience constructor that is equivalent to MockUser(username, "", null, null).
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, 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()
void setActive(boolean active)
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

Public Constructors

public MockUser (String username)

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

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, 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 void setActive (boolean active)

public String toString ()