热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

org.hamcrest.collection.IsIterableContainingInAnyOrder.()方法的使用及代码示例

本文整理了Java中org.hamcrest.collection.IsIterableContainingInAnyOrder.<init>()方法的一些

本文整理了Java中org.hamcrest.collection.IsIterableContainingInAnyOrder.()方法的一些代码示例,展示了IsIterableContainingInAnyOrder.()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IsIterableContainingInAnyOrder.()方法的具体详情如下:
包路径:org.hamcrest.collection.IsIterableContainingInAnyOrder
类名称:IsIterableContainingInAnyOrder
方法名:

IsIterableContainingInAnyOrder.介绍

暂无

代码示例

代码示例来源:origin: org.hamcrest/hamcrest-all

public IsArrayContainingInAnyOrder(Collection> matchers) {
this.iterableMatcher = new IsIterableContainingInAnyOrder(matchers);
this.matchers = matchers;
}

代码示例来源:origin: hamcrest/JavaHamcrest

public IsArrayContainingInAnyOrder(Collection> matchers) {
this.iterableMatcher = new IsIterableContainingInAnyOrder(matchers);
this.matchers = matchers;
}

代码示例来源: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 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}
*/
public static Matcher> containsInAnyOrder(Collection> itemMatchers) {
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 Matcher> containsInAnyOrder(Collection> itemMatchers) {
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 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 Matcher> containsInAnyOrder(T... items) {
List> matchers = new ArrayList>();
for (T item : items) {
matchers.add(equalTo(item));
}

return new IsIterableContainingInAnyOrder(matchers);
}

代码示例来源: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 Matcher arrayContainingInAnyOrder(Collection> itemMatchers) {
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 Matcher> containsInAnyOrder(T... items) {
List> matchers = new ArrayList<>();
for (T item : items) {
matchers.add(equalTo(item));
}

return new IsIterableContainingInAnyOrder<>(matchers);
}

代码示例来源:origin: org.hamcrest/java-hamcrest

public IsArrayContainingInAnyOrder(Collection> matchers) {
this.iterableMatcher = new IsIterableContainingInAnyOrder(matchers);
this.matchers = matchers;
}

代码示例来源: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 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}
*/
public static Matcher> containsInAnyOrder(Collection> itemMatchers) {
return new IsIterableContainingInAnyOrder(itemMatchers);
}
}

代码示例来源: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 Matcher> containsInAnyOrder(T... items) {
List> matchers = new ArrayList>();
for (T item : items) {
matchers.add(equalTo(item));
}

return new IsIterableContainingInAnyOrder(matchers);
}

代码示例来源:origin: org.hamcrest/hamcrest

public IsArrayContainingInAnyOrder(Collection> matchers) {
this.iterableMatcher = new IsIterableContainingInAnyOrder(matchers);
this.matchers = matchers;
}

代码示例来源:origin: org.hamcrest/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 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}
*/
public static Matcher> containsInAnyOrder(Collection> itemMatchers) {
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> matchesInAnyOrder(List> elementsMatcher) {
// Let's force Matcher>, since Element is an interface
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 Matcher arrayContainingInAnyOrder(Collection> itemMatchers) {
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> matchers = new ArrayList>(size);
for (int i=0; i {
matchers.add((Matcher)entityCondition(conditions.getCondition(i)));
}
this.cOnditions= new IsIterableContainingInAnyOrder(matchers);
}

代码示例来源: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 matchers = createCollectionMatchers(iterator);
return new IsIterableContainingInAnyOrder(matchers);
}
if (Map.class.isAssignableFrom(object.getClass())) {
Map map = (Map) object;
if (map.isEmpty()) {
return IsEmptyMap.emptyMap();
}
List matchers = createMapMatchers(map);
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> propertyMatchers = Arrays.asList(properties);
@SuppressWarnings("unchecked")
final Matcher> iterableMatcher = new IsIterableContainingInAnyOrder(propertyMatchers);
return new DefinitionRawViewMatcher(emptySeed()).withProperties(iterableMatcher);
}

代码示例来源:origin: info.magnolia.ui/magnolia-ui-framework

@Test
public void bindsUiContextEventBuses() throws Exception {
// WHEN
final List> eventBusBindings = injector.findBindingsByType(TypeLiteral.get(EventBus.class));
// 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> uiCOntextBindings= injector.findBindingsByType(TypeLiteral.get(UiContext.class));
// 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 compOnents= this.uiComponentConfigurationAggregator.aggregate().getAnnotatedComponents();
// THEN
assertThat(components.values(), new IsIterableContainingInAnyOrder(Arrays.asList(
implementationConfiguration()
.withType(Baz.class)
.withBindingContext(UiAnnotations.forSubApp("fooBar", "qux")))));
}

推荐阅读
author-avatar
竹茹士弘宜来
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有