Class UserMatcher<E extends User>
java.lang.Object
org.hamcrest.BaseMatcher<E>
org.hamcrest.TypeSafeMatcher<E>
com.atlassian.crowd.test.matchers.UserMatcher<E>
- All Implemented Interfaces:
org.hamcrest.Matcher<E>,org.hamcrest.SelfDescribing
-
Constructor Summary
ConstructorsConstructorDescriptionUserMatcher(org.hamcrest.Matcher<String> nameMatcher, org.hamcrest.Matcher<Boolean> activeMatcher, org.hamcrest.Matcher<String> externalIdMatcher) -
Method Summary
Modifier and TypeMethodDescriptionvoiddescribeTo(org.hamcrest.Description description) protected booleanmatchesSafely(E item) static <T extends User>
UserMatcher<T> user()A matcher that matches any user.static <T extends User>
UserMatcher<T> A matcher that matches any user; synonymous withuser()but its argument is used to set the matcher type.static <T extends User>
UserMatcher<T> A matcher that matches a user with the given name.withActive(boolean active) Builds a new specialised matcher to match the given active status; the returned matcher will only match if all this matcher's non-username constraints are matched AND the given status is equal to the user's active status.withExternalIdMatching(org.hamcrest.Matcher<String> externalIdMatcher) Builds a new specialised matcher to match on the externalId.withExternalIdOf(String externalId) Builds a new specialised matcher to match the given externalId.withNameMatching(org.hamcrest.Matcher<String> nameMatcher) Builds a new specialised matcher to match on username; the returned matcher will only match if all this matcher's non-username constraints are matched AND the given matcher matches the user's username.withNameOf(String name) Builds a new specialised matcher to match the given username exactly; the returned matcher will only match if all this matcher's non-username constraints are matched AND the given string is equal to the user's username.Methods inherited from class org.hamcrest.TypeSafeMatcher
describeMismatch, describeMismatchSafely, matchesMethods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toString
-
Constructor Details
-
UserMatcher
-
-
Method Details
-
user
A matcher that matches any user.- Type Parameters:
T- type of user, to avoid casting- Returns:
- a matcher which matches any user
-
user
A matcher that matches any user; synonymous withuser()but its argument is used to set the matcher type.- Type Parameters:
T- type of user, to avoid casting- Parameters:
type- type of user, to avoid casting (this type is not checked at runtime).- Returns:
- a matcher which matches any user
-
userNamed
A matcher that matches a user with the given name.- Type Parameters:
T- type of user, to avoid casting- Returns:
- a matcher which matches a user with the given name.
-
withNameMatching
Builds a new specialised matcher to match on username; the returned matcher will only match if all this matcher's non-username constraints are matched AND the given matcher matches the user's username. Any existing username constraint is discarded.- Parameters:
nameMatcher- matcher which must match the user's username in order for this matcher to match- Returns:
- a matcher will only match if all this matcher's non-username constraints are matched AND the given matcher matches the user's username
-
withNameOf
Builds a new specialised matcher to match the given username exactly; the returned matcher will only match if all this matcher's non-username constraints are matched AND the given string is equal to the user's username. Any existing username constraint is discarded.- Parameters:
name- string which must equal the user's username in order for this matcher to match- Returns:
- a matcher will only match if all this matcher's non-username constraints are matched AND the given string is equal to the user's username
-
withActive
Builds a new specialised matcher to match the given active status; the returned matcher will only match if all this matcher's non-username constraints are matched AND the given status is equal to the user's active status.- Parameters:
active- the status must equal the user's status (as perUser.isActive()) in order for this matcher to match- Returns:
- a matcher will only match if all this matcher's non-active-status constraints are matched AND the given status is equal to the user's active status
-
withExternalIdMatching
Builds a new specialised matcher to match on the externalId.- Parameters:
externalIdMatcher- matcher which must match the user's externalId (as perUser.getExternalId()()}) in order for this matcher to match- Returns:
- a matcher
-
withExternalIdOf
Builds a new specialised matcher to match the given externalId.- Parameters:
externalId- the provided externalId must equal the user's externalId (as perUser.getExternalId()()}) in order for this matcher to match- Returns:
- a matcher
-
matchesSafely
-
describeTo
public void describeTo(org.hamcrest.Description description)
-