Top Fields Constructors Methods
org.hamcrest.collection

public Class IsArrayContainingInAnyOrder<E>

extends TypeSafeMatcher<E[]>
Class Inheritance
Annotations
@Deprecated
Imports
org.hamcrest.Description, .Matcher, .TypeSafeMatcher, java.util.ArrayList, .Arrays, .Collection, .List

Deprecated

As of release 2.1, replaced by ArrayMatching.

Field Summary

Modifier and TypeField and Description
private final IsIterableContainingInAnyOrder<E>
private final Collection<Matcher<? super E>>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static <E> Matcher<E[]>
arrayContainingInAnyOrder(Matcher<? super E>...
a list of matchers, each of which must be satisfied by an entry in an examined array
itemMatchers
)

Deprecated As of version 2.1, use ArrayMatching#arrayContainingInAnyOrder(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.
public static <E> Matcher<E[]>
arrayContainingInAnyOrder(Collection<Matcher<? super E>>
a list of matchers, each of which must be satisfied by an item provided by an examined array
itemMatchers
)

Deprecated As of version 2.1, use ArrayMatching#arrayContainingInAnyOrder(Collection).
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<E[]>
arrayContainingInAnyOrder(E...
the items that must equal the entries of an examined array, in any order
items
)

Deprecated As of version 2.1, use ArrayMatching#arrayContainingInAnyOrder(Object[]).
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 void
describeMismatchSafely(E[] item, Description mismatchDescription)

Overrides org.hamcrest.TypeSafeMatcher.describeMismatchSafely.

Subclasses should override this.
public void
describeTo(Description
The description to be built or appended to.
description
)

Implements org.hamcrest.SelfDescribing.describeTo.

Generates a description of the object.
public boolean
matchesSafely(E[] item)

Implements abstract org.hamcrest.TypeSafeMatcher.matchesSafely.

Subclasses should implement this.
Inherited from org.hamcrest.TypeSafeMatcher:
describeMismatchmatches

Field Detail

iterableMatcherback to summary
private final IsIterableContainingInAnyOrder<E> iterableMatcher
matchersback to summary
private final Collection<Matcher<? super E>> matchers

Constructor Detail

IsArrayContainingInAnyOrderback to summary
public IsArrayContainingInAnyOrder(Collection<Matcher<? super E>> matchers)

Method Detail

arrayContainingInAnyOrderback to summary
public static <E> Matcher<E[]> arrayContainingInAnyOrder(Matcher<? super E>... itemMatchers)

Deprecated

As of version 2.1, use ArrayMatching#arrayContainingInAnyOrder(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")))
Parameters
itemMatchers:Matcher<? super E>[]

a list of matchers, each of which must be satisfied by an entry in an examined array

arrayContainingInAnyOrderback to summary
public static <E> Matcher<E[]> arrayContainingInAnyOrder(Collection<Matcher<? super E>> itemMatchers)

Deprecated

As of version 2.1, use ArrayMatching#arrayContainingInAnyOrder(Collection).

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"))))
Parameters
itemMatchers:Collection<Matcher<? super E>>

a list of matchers, each of which must be satisfied by an item provided by an examined array

arrayContainingInAnyOrderback to summary
public static <E> Matcher<E[]> arrayContainingInAnyOrder(E... items)

Deprecated

As of version 2.1, use ArrayMatching#arrayContainingInAnyOrder(Object[]).

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"))
Parameters
items:E[]

the items that must equal the entries of an examined array, in any order

describeMismatchSafelyback to summary
public void describeMismatchSafely(E[] item, Description mismatchDescription)

Overrides org.hamcrest.TypeSafeMatcher.describeMismatchSafely.

Doc from org.hamcrest.TypeSafeMatcher.describeMismatchSafely.

Subclasses should override this. The item will already have been checked for the specific type and will never be null.

Annotations
@Override
describeToback to summary
public void describeTo(Description description)

Implements org.hamcrest.SelfDescribing.describeTo.

Doc from org.hamcrest.SelfDescribing.describeTo.

Generates a description of the object. The description may be part of a a description of a larger object of which this is just a component, so it should be worded appropriately.

Parameters
description:Description

The description to be built or appended to.

Annotations
@Override
matchesSafelyback to summary
public boolean matchesSafely(E[] item)

Implements abstract org.hamcrest.TypeSafeMatcher.matchesSafely.

Doc from org.hamcrest.TypeSafeMatcher.matchesSafely.

Subclasses should implement this. The item will already have been checked for the specific type and will never be null.

Annotations
@Override