org.hamcrest.collection
Class IsArrayContaining<T>
java.lang.Object
org.hamcrest.BaseMatcher<T>
org.hamcrest.TypeSafeMatcher<T[]>
org.hamcrest.collection.IsArrayContaining<T>
- All Implemented Interfaces:
- org.hamcrest.Matcher<T[]>, org.hamcrest.SelfDescribing
public class IsArrayContaining<T>
- extends org.hamcrest.TypeSafeMatcher<T[]>
Matches if an array contains an item satisfying a nested matcher.
|
Method Summary |
void |
describeMismatchSafely(T[] item,
org.hamcrest.Description mismatchDescription)
|
void |
describeTo(org.hamcrest.Description description)
|
static
<T> org.hamcrest.Matcher<T[]> |
|
hasItemInArray(org.hamcrest.Matcher<? super T> elementMatcher)
Evaluates to true if any item in an array satisfies the given matcher. |
static
<T> org.hamcrest.Matcher<T[]> |
|
hasItemInArray(T element)
This is a shortcut to the frequently used hasItemInArray(equalTo(x)). |
boolean |
matchesSafely(T[] array)
|
| Methods inherited from class org.hamcrest.TypeSafeMatcher |
describeMismatch, matches |
| Methods inherited from class org.hamcrest.BaseMatcher |
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
IsArrayContaining
public IsArrayContaining(org.hamcrest.Matcher<? super T> elementMatcher)
matchesSafely
public boolean matchesSafely(T[] array)
- Specified by:
matchesSafely in class org.hamcrest.TypeSafeMatcher<T[]>
describeMismatchSafely
public void describeMismatchSafely(T[] item,
org.hamcrest.Description mismatchDescription)
- Overrides:
describeMismatchSafely in class org.hamcrest.TypeSafeMatcher<T[]>
describeTo
public void describeTo(org.hamcrest.Description description)
hasItemInArray
public static <T> org.hamcrest.Matcher<T[]> hasItemInArray(org.hamcrest.Matcher<? super T> elementMatcher)
- Evaluates to true if any item in an array satisfies the given matcher.
hasItemInArray
public static <T> org.hamcrest.Matcher<T[]> hasItemInArray(T element)
- This is a shortcut to the frequently used hasItemInArray(equalTo(x)).
For example, assertThat(hasItemInArray(equal_to(x)))
vs. assertThat(hasItemInArray(x))
Copyright © 2010. All Rights Reserved.