org.hamcrest.Matchers#contains ( )源码实例Demo

下面列出了org.hamcrest.Matchers#contains ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: monsoon   文件: InfluxHistoryTest.java
private static Matcher<Iterable<? extends TimeSeriesCollection>> computeDataMatcher(Collection<KeyedQuery> queries, boolean reverse) {
    final List<Matcher<? super TimeSeriesCollection>> result = computeData(queries)
            .map(Matchers::equalTo)
            .collect(Collectors.toList());
    if (reverse) Collections.reverse(result);
    return Matchers.contains(result);
}
 
源代码2 项目: beam   文件: WindowMatchers.java
public static <T> Matcher<WindowedValue<? extends T>> isSingleWindowedValue(
    Matcher<? super T> valueMatcher,
    Matcher<? super Instant> timestampMatcher,
    Matcher<? super BoundedWindow> windowMatcher) {
  return new WindowedValueMatcher<>(
      valueMatcher, timestampMatcher, Matchers.contains(windowMatcher), Matchers.anything());
}
 
源代码3 项目: beam   文件: WindowMatchers.java
public static <T> Matcher<WindowedValue<? extends T>> isSingleWindowedValue(
    Matcher<? super T> valueMatcher,
    Matcher<? super Instant> timestampMatcher,
    Matcher<? super BoundedWindow> windowMatcher,
    Matcher<? super PaneInfo> paneInfoMatcher) {
  return new WindowedValueMatcher<>(
      valueMatcher, timestampMatcher, Matchers.contains(windowMatcher), paneInfoMatcher);
}
 
源代码4 项目: buck   文件: TypeCoercerTest.java
/** Traverse visits every element of an input value without coercing to the output type. */
@Test
public void traverseShouldVisitEveryObject() throws NoSuchFieldException {
  Type type = TestFields.class.getField("stringMapOfLists").getGenericType();
  @SuppressWarnings("unchecked")
  TypeCoercer<Object, ImmutableMap<String, ImmutableList<String>>> coercer =
      (TypeCoercer<Object, ImmutableMap<String, ImmutableList<String>>>)
          typeCoercerFactory.typeCoercerForType(TypeToken.of(type));

  ImmutableMap<String, ImmutableList<String>> input =
      ImmutableMap.of(
          "foo", ImmutableList.of("//foo:bar", "//foo:baz"),
          "bar", ImmutableList.of(":bar", "//foo:foo"));

  TestTraversal traversal = new TestTraversal();
  coercer.traverse(cellNameResolver, input, traversal);

  Matcher<Iterable<?>> matcher =
      Matchers.contains(
          ImmutableList.of(
              sameInstance((Object) input),
              is((Object) "foo"),
              sameInstance((Object) input.get("foo")),
              is((Object) "//foo:bar"),
              is((Object) "//foo:baz"),
              is((Object) "bar"),
              sameInstance((Object) input.get("bar")),
              is((Object) ":bar"),
              is((Object) "//foo:foo")));
  assertThat(traversal.getObjects(), matcher);
}
 
源代码5 项目: sakai   文件: MatcherUtils.java
public static <T, R> Matcher<Iterable<? extends R>> containsUsingCustomMatcher(List<T> items, MatcherFunction<T, R> matcherFunction) {
    return Matchers.contains(createMatchers(items, matcherFunction));
}
 
源代码6 项目: sakai   文件: MatcherUtils.java
public static <T, R> Matcher<Iterable<? extends R>> containsUsingCustomMatcher(List<T> items, MatcherFunction<T, R> matcherFunction) {
    return Matchers.contains(createMatchers(items, matcherFunction));
}