本文整理了Java中org.hamcrest.collection.IsIterableContainingInAnyOrder.
方法的一些代码示例,展示了IsIterableContainingInAnyOrder.
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IsIterableContainingInAnyOrder.
方法的具体详情如下:
包路径:org.hamcrest.collection.IsIterableContainingInAnyOrder
类名称:IsIterableContainingInAnyOrder
方法名:
暂无
代码示例来源:origin: org.hamcrest/hamcrest-all
public IsArrayContainingInAnyOrder(Collection
this.iterableMatcher = new IsIterableContainingInAnyOrder
this.matchers = matchers;
}
代码示例来源:origin: hamcrest/JavaHamcrest
public IsArrayContainingInAnyOrder(Collection
this.iterableMatcher = new IsIterableContainingInAnyOrder
this.matchers = matchers;
}
代码示例来源:origin: hamcrest/JavaHamcrest
For example:/**
*
* Creates an order agnostic matcher for {@link Iterable}s that matches when a single pass over
* the examined {@link Iterable} yields a series of items, each satisfying one matcher anywhere
* in the specified collection of matchers. For a positive match, the examined iterable
* 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 iterable.
*
*
* assertThat(Arrays.asList("foo", "bar"), containsInAnyOrder(Arrays.asList(equalTo("bar"), equalTo("foo"))))
*
* @param itemMatchers
* a list of matchers, each of which must be satisfied by an item provided by an examined {@link Iterable}
*/
public static
return new IsIterableContainingInAnyOrder<>(itemMatchers);
}
}
代码示例来源:origin: org.hamcrest/hamcrest-all
/**
* Creates an order agnostic matcher for {@link Iterable}s that matches when a single pass over
* the examined {@link Iterable} yields a series of items, each satisfying one matcher anywhere
* in the specified collection of matchers. For a positive match, the examined iterable
* 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 iterable.
*
* For example:
* assertThat(Arrays.asList("foo", "bar"), containsInAnyOrder(Arrays.asList(equalTo("bar"), equalTo("foo"))))
*
* @param itemMatchers
* a list of matchers, each of which must be satisfied by an item provided by an examined {@link Iterable}
*/
@Factory
public static
return new IsIterableContainingInAnyOrder
}
}
代码示例来源:origin: org.hamcrest/hamcrest-all
/**
* Creates an order agnostic matcher for {@link Iterable}s that matches when a single pass over
* the examined {@link Iterable} yields a series of items, each logically equal to one item
* anywhere in the specified items. For a positive match, the examined iterable
* 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
* iterable.
*
* For example:
* assertThat(Arrays.asList("foo", "bar"), containsInAnyOrder("bar", "foo"))
*
* @param items
* the items that must equal the items provided by an examined {@link Iterable} in any order
*/
@Factory
public static
List
for (T item : items) {
matchers.add(equalTo(item));
}
return new IsIterableContainingInAnyOrder
}
代码示例来源:origin: hamcrest/JavaHamcrest
/**
*
* 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"))))
*
* @param itemMatchers
* a list of matchers, each of which must be satisfied by an item provided by an examined array
*/
public static
return new ArrayAsIterableMatcher<>(new IsIterableContainingInAnyOrder<>(itemMatchers), itemMatchers, "in any order");
}
代码示例来源:origin: hamcrest/JavaHamcrest
/**
*
* Creates an order agnostic matcher for {@link Iterable}s that matches when a single pass over
* the examined {@link Iterable} yields a series of items, each logically equal to one item
* anywhere in the specified items. For a positive match, the examined iterable
* 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
* iterable.
*
*
* For example:
*
* assertThat(Arrays.asList("foo", "bar"), containsInAnyOrder("bar", "foo"))
*
* @param items
* the items that must equal the items provided by an examined {@link Iterable} in any order
*/
@SafeVarargs
public static
List
for (T item : items) {
matchers.add(equalTo(item));
}
return new IsIterableContainingInAnyOrder<>(matchers);
}
代码示例来源:origin: org.hamcrest/java-hamcrest
public IsArrayContainingInAnyOrder(Collection
this.iterableMatcher = new IsIterableContainingInAnyOrder
this.matchers = matchers;
}
代码示例来源:origin: org.hamcrest/java-hamcrest
For example:/**
*
* Creates an order agnostic matcher for {@link Iterable}s that matches when a single pass over
* the examined {@link Iterable} yields a series of items, each satisfying one matcher anywhere
* in the specified collection of matchers. For a positive match, the examined iterable
* 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 iterable.
*
*
* assertThat(Arrays.asList("foo", "bar"), containsInAnyOrder(Arrays.asList(equalTo("bar"), equalTo("foo"))))
*
* @param itemMatchers
* a list of matchers, each of which must be satisfied by an item provided by an examined {@link Iterable}
*/
public static
return new IsIterableContainingInAnyOrder
}
}
代码示例来源:origin: org.hamcrest/java-hamcrest
/**
*
* Creates an order agnostic matcher for {@link Iterable}s that matches when a single pass over
* the examined {@link Iterable} yields a series of items, each logically equal to one item
* anywhere in the specified items. For a positive match, the examined iterable
* 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
* iterable.
*
*
* For example:
*
* assertThat(Arrays.asList("foo", "bar"), containsInAnyOrder("bar", "foo"))
*
* @param items
* the items that must equal the items provided by an examined {@link Iterable} in any order
*/
public static
List
for (T item : items) {
matchers.add(equalTo(item));
}
return new IsIterableContainingInAnyOrder
}
代码示例来源:origin: org.hamcrest/hamcrest
public IsArrayContainingInAnyOrder(Collection
this.iterableMatcher = new IsIterableContainingInAnyOrder
this.matchers = matchers;
}
代码示例来源:origin: org.hamcrest/hamcrest
For example:/**
*
* Creates an order agnostic matcher for {@link Iterable}s that matches when a single pass over
* the examined {@link Iterable} yields a series of items, each satisfying one matcher anywhere
* in the specified collection of matchers. For a positive match, the examined iterable
* 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 iterable.
*
*
* assertThat(Arrays.asList("foo", "bar"), containsInAnyOrder(Arrays.asList(equalTo("bar"), equalTo("foo"))))
*
* @param itemMatchers
* a list of matchers, each of which must be satisfied by an item provided by an examined {@link Iterable}
*/
public static
return new IsIterableContainingInAnyOrder<>(itemMatchers);
}
}
代码示例来源:origin: org.testinfected.hamcrest-matchers/dom-matchers
/**
* Checks that a collection contains {@link org.w3c.dom.Element}s that are matched
* in any order by the specified list of matchers.
*
* Each element in the collection must be matched and each specified matcher must match an element.
* Matching can occur in any order.
*
*
* Note: As of hamcrest 1.3, the hasItems
family of matchers return Matcher
* whereas the contains
family of matchers return Iterable
.
* Unfortunately, this makes them impossible to combine as arguments to
* {@link DomMatchers#hasSelector(String, org.hamcrest.Matcher)} without this method.
*
*
* @param elementsMatcher the list fo matchers to match the collection of {@link org.w3c.dom.Element}s
*/
@SuppressWarnings("unchecked")
public static Matcher
// Let's force Matcher
return new IsIterableContainingInAnyOrder(elementsMatcher);
}
代码示例来源:origin: org.hamcrest/hamcrest
/**
*
* 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"))))
*
* @param itemMatchers
* a list of matchers, each of which must be satisfied by an item provided by an examined array
*/
public static
return new ArrayAsIterableMatcher<>(new IsIterableContainingInAnyOrder<>(itemMatchers), itemMatchers, "in any order");
}
代码示例来源:origin: com.atlassian.jira/jira-tests
@SuppressWarnings("unchecked") // hamcrest's generics are broken :(
private EntityConditionListMatcher(EntityConditionList conditions)
{
this.expectedOperator = conditions.getOperator();
final int size = conditions.getConditionListSize();
final List
for (int i=0; i
matchers.add((Matcher
}
this.cOnditions= new IsIterableContainingInAnyOrder
}
代码示例来源:origin: com.atlassian.plugins/atlassian-connect-unit-test-support
@SuppressWarnings("unchecked")
private static Matcher createMatcher(Object object) {
if (null == object) {
return equalTo(object);
}
if (Iterable.class.isAssignableFrom(object.getClass())) {
Iterator iterator = ((Iterable) object).iterator();
if (!iterator.hasNext()) {
return empty();
}
List
return new IsIterableContainingInAnyOrder(matchers);
}
if (Map.class.isAssignableFrom(object.getClass())) {
Map map = (Map) object;
if (map.isEmpty()) {
return IsEmptyMap.emptyMap();
}
List
return new AllOf(matchers);
}
if (Comparable.class.isAssignableFrom(object.getClass())) {
return equalTo(object);
}
return sameDeepPropertyValuesAs(object);
}
代码示例来源:origin: info.magnolia.core/magnolia-configuration
public static DefinitionRawViewMatcher rawView(PropertyMatcher... properties) {
final Collection extends Matcher
@SuppressWarnings("unchecked")
final Matcher
return new DefinitionRawViewMatcher(emptySeed()).withProperties(iterableMatcher);
}
代码示例来源:origin: info.magnolia.ui/magnolia-ui-framework
@Test
public void bindsUiContextEventBuses() throws Exception {
// WHEN
final List extends Binding
// THEN
assertThat(eventBusBindings, new IsIterableContainingInAnyOrder(Arrays.asList(
binding().withKey(Key.get(EventBus.class, named(AdmincentralEventBus.NAME))),
binding().withKey(Key.get(EventBus.class, named(AppEventBus.NAME))),
binding().withKey(Key.get(EventBus.class, named(SubAppEventBus.NAME))),
binding().withKey(Key.get(EventBus.class, named(ChooseDialogEventBus.NAME))),
binding().withKey(Key.get(EventBus.class, named("mediaeditor"))))));
}
代码示例来源:origin: info.magnolia.ui/magnolia-ui-framework
@Test
public void bindsUiContextInAllScopes() throws Exception {
// WHEN
final List extends Binding
// THEN
assertThat(uiContextBindings, new IsIterableContainingInAnyOrder(Arrays.asList(
providerInstanceBinding().withKey(Key.get(UiContext.class)),
linkedKeyBinding().withKey(Key.get(UiContext.class, UiAnnotations.forAdmincentral())),
linkedKeyBinding().withKey(Key.get(UiContext.class, UiAnnotations.forM5Admincentral())),
linkedKeyBinding().withKey(Key.get(UiContext.class, App.class)),
linkedKeyBinding().withKey(Key.get(UiContext.class, SubApp.class)),
linkedKeyBinding().withKey(Key.get(UiContext.class, View.class)))));
}
代码示例来源:origin: info.magnolia.ui/magnolia-ui-framework
/**
* See MGNLUI-4281 for further details about the issue
*/
@Test
public void ableToGracefullyDistinguishComponentsOfAppsWithSimilarNames() throws Exception {
// GIVEN
final ModuleDefinition moduleDefinition = readModule("potentially_ambiguous_app_component.xml");
this.uiCompOnentConfigurationAggregator= new UiComponentConfigurationAggregator(singletonList(moduleDefinition), appNames);
// WHEN
final Map
// THEN
assertThat(components.values(), new IsIterableContainingInAnyOrder(Arrays.asList(
implementationConfiguration()
.withType(Baz.class)
.withBindingContext(UiAnnotations.forSubApp("fooBar", "qux")))));
}