|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.atlassian.jira.user.MockUser
public class MockUser
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.
Constructor Summary | |
---|---|
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<String,Set<String>> values)
Creates a new mock user with the specified information. |
Method Summary | |
---|---|
int |
compareTo(com.atlassian.crowd.embedded.api.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()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public MockUser(String username)
MockUser(username, "", null, null)
.
public MockUser(String username, String fullName, String email)
MockUser(username, fullName, email, null)
.
public MockUser(String username, String fullName, String email, Map<String,Set<String>> values)
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.Method Detail |
---|
public boolean isActive()
MockUser
is always active by default.
isActive
in interface com.atlassian.crowd.embedded.api.User
public void setActive(boolean active)
public String getEmailAddress()
getEmailAddress
in interface com.atlassian.crowd.embedded.api.User
public String getDisplayName()
getDisplayName
in interface com.atlassian.crowd.embedded.api.User
public long getDirectoryId()
getDirectoryId
in interface com.atlassian.crowd.embedded.api.User
public String getName()
getName
in interface Principal
public String toString()
toString
in interface Principal
toString
in class Object
public Set<String> getValues(String key)
getValues
in interface com.atlassian.crowd.embedded.api.Attributes
public String getValue(String key)
getValue
in interface com.atlassian.crowd.embedded.api.Attributes
public Set<String> getKeys()
getKeys
in interface com.atlassian.crowd.embedded.api.Attributes
public boolean isEmpty()
isEmpty
in interface com.atlassian.crowd.embedded.api.Attributes
public boolean equals(Object o)
equals
in interface com.atlassian.crowd.embedded.api.User
equals
in interface Principal
equals
in class Object
public int hashCode()
hashCode
in interface com.atlassian.crowd.embedded.api.User
hashCode
in interface Principal
hashCode
in class Object
public int compareTo(com.atlassian.crowd.embedded.api.User other)
compareTo
in interface com.atlassian.crowd.embedded.api.User
compareTo
in interface Comparable<com.atlassian.crowd.embedded.api.User>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |