| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public static <E> Matcher | arrayContaining(E...
the items that must equal the items within an examined array items)Creates a matcher for arrays that matches when each item in the examined array is logically equal to the corresponding item in the specified items. |
| public static <E> Matcher | arrayContaining(Matcher<? super E>...
the matchers that must be satisfied by the items in the examined array itemMatchers)Creates a matcher for arrays that matches when each item in the examined array satisfies the corresponding matcher in the specified matchers. |
| public static <E> Matcher | arrayContaining(List<Matcher<? super E>>
a list of matchers, each of which must be satisfied by the corresponding item in an examined array itemMatchers)Creates a matcher for arrays that matches when each item in the examined array satisfies the corresponding matcher in the specified list of matchers. |
| public static <E> Matcher | arrayContainingInAnyOrder(Matcher<? super E>...
a list of matchers, each of which must be satisfied by an entry in an examined array itemMatchers)Creates an order agnostic matcher for arrays that matches when each item in the examined array satisfies one matcher anywhere in the specified matchers. |
| public static <E> Matcher | arrayContainingInAnyOrder(Collection<Matcher<? super E>>
a list of matchers, each of which must be satisfied by an item provided by an examined array itemMatchers)Creates an order agnostic matcher for arrays that matches when each item in the examined array satisfies one matcher anywhere in the specified collection of matchers. |
| public static <E> Matcher | arrayContainingInAnyOrder(E...
the items that must equal the entries of an examined array, in any order items)Creates an order agnostic matcher for arrays that matches when each item in the examined array is logically equal to one item anywhere in the specified items. |
| public static <E> List | |
| public static <T> Matcher | hasItemInArray(Matcher<? super T>
the matcher to apply to elements in examined arrays elementMatcher)Creates a matcher for arrays that matches when the examined array contains at least one item
that is matched by the specified |
| public static <T> Matcher | hasItemInArray(T
the element that should be present in examined arrays element)A shortcut to the frequently used |
| ArrayMatching | back to summary |
|---|---|
| public ArrayMatching() | |
| arrayContaining | back to summary |
|---|---|
| public static <E> Matcher Creates a matcher for arrays that matches when each item in the examined array is logically equal to the corresponding item in the specified items. For a positive match, the examined array must be of the same length as the number of specified items. For example: assertThat(new String[]{"foo", "bar"}, contains("foo", "bar"))
| |
| arrayContaining | back to summary |
|---|---|
| public static <E> Matcher Creates a matcher for arrays that matches when each item in the examined array satisfies the corresponding matcher in the specified matchers. For a positive match, the examined array must be of the same length as the number of specified matchers. For example: assertThat(new String[]{"foo", "bar"}, arrayContaining(equalTo("foo"), equalTo("bar")))
| |
| arrayContaining | back to summary |
|---|---|
| public static <E> Matcher Creates a matcher for arrays that matches when each item in the examined array satisfies the corresponding matcher in the specified list of matchers. For a positive match, the examined array must be of the same length as the specified list of matchers. For example: assertThat(new String[]{"foo", "bar"}, arrayContaining(Arrays.asList(equalTo("foo"), equalTo("bar"))))
| |
| arrayContainingInAnyOrder | back to summary |
|---|---|
| public static <E> Matcher Creates an order agnostic matcher for arrays that matches when each item in the examined array satisfies one matcher anywhere in the specified matchers. For a positive match, the examined array must be of the same length as the number of specified matchers. N.B. each of the specified matchers will only be used once during a given examination, so be careful when specifying matchers that may be satisfied by more than one entry in an examined array. For example: assertThat(new String[]{"foo", "bar"}, arrayContainingInAnyOrder(equalTo("bar"), equalTo("foo")))
| |
| arrayContainingInAnyOrder | back to summary |
|---|---|
| public static <E> Matcher Creates an order agnostic matcher for arrays that matches when each item in the examined array satisfies one matcher anywhere in the specified collection of matchers. For a positive match, the examined array must be of the same length as the specified collection of matchers. N.B. each matcher in the specified collection will only be used once during a given examination, so be careful when specifying matchers that may be satisfied by more than one entry in an examined array. For example: assertThat(new String[]{"foo", "bar"}, arrayContainingInAnyOrder(Arrays.asList(equalTo("bar"), equalTo("foo"))))
| |
| arrayContainingInAnyOrder | back to summary |
|---|---|
| public static <E> Matcher Creates an order agnostic matcher for arrays that matches when each item in the examined array is logically equal to one item anywhere in the specified items. For a positive match, the examined array must be of the same length as the number of specified items. N.B. each of the specified items will only be used once during a given examination, so be careful when specifying items that may be equal to more than one entry in an examined array. For example: assertThat(new String[]{"foo", "bar"}, containsInAnyOrder("bar", "foo"))
| |
| asEqualMatchers | back to summary |
|---|---|
| public static <E> List | |
| hasItemInArray | back to summary |
|---|---|
| public static <T> Matcher Creates a matcher for arrays that matches when the examined array contains at least one item
that is matched by the specified assertThat(new String[] {"foo", "bar"}, hasItemInArray(startsWith("ba")))
| |
| hasItemInArray | back to summary |
|---|---|
| public static <T> Matcher A shortcut to the frequently used assertThat(hasItemInArray(x))instead of: assertThat(hasItemInArray(equalTo(x)))
| |