org.hamcrest.Factory.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(5.3k)|赞(0)|评价(0)|浏览(117)

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

Factory.<init>介绍

暂无

代码示例

代码示例来源:origin: junit-team/junit4

/**
   * Returns a matcher that verifies that the outer exception has a cause for which the supplied matcher
   * evaluates to true.
   *
   * @param matcher to apply to the cause of the outer exception
   * @param <T> type of the outer exception
   */
  @Factory
  public static <T extends Throwable> Matcher<T> hasCause(final Matcher<?> matcher) {
    return new ThrowableCauseMatcher<T>(matcher);
  }
}

代码示例来源:origin: junit-team/junit4

@Factory
public static <T extends Throwable> Matcher<T> isThrowable(
    Matcher<T> throwableMatcher) {
  return new StacktracePrintingMatcher<T>(throwableMatcher);
}

代码示例来源:origin: junit-team/junit4

@Factory
  public static <T extends Exception> Matcher<T> isException(
      Matcher<T> exceptionMatcher) {
    return new StacktracePrintingMatcher<T>(exceptionMatcher);
  }
}

代码示例来源:origin: junit-team/junit4

@Factory
  public static <T extends Throwable> Matcher<T> hasMessage(final Matcher<String> matcher) {
    return new ThrowableMessageMatcher<T>(matcher);
  }
}

代码示例来源:origin: google/j2objc

@Factory
  public static <T extends Throwable> Matcher<T> hasCause(final Matcher<T> matcher) {
    return new ThrowableCauseMatcher<T>(matcher);
  }
}

代码示例来源:origin: google/j2objc

@Factory
  public static <T extends Exception> Matcher<T> isException(
      Matcher<T> exceptionMatcher) {
    return new StacktracePrintingMatcher<T>(exceptionMatcher);
  }
}

代码示例来源:origin: google/j2objc

/**
 * Creates a matcher that matches if the examined object matches <b>ANY</b> of the specified matchers.
 * <p/>
 * For example:
 * <pre>assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))</pre>
 */
@Factory
public static <T> AnyOf<T> anyOf(Iterable<Matcher<? super T>> matchers) {
  return new AnyOf<T>(matchers);
}

代码示例来源:origin: google/j2objc

/**
 * Creates a matcher that matches if the examined object matches <b>ALL</b> of the specified matchers.
 * <p/>
 * For example:
 * <pre>assertThat("myValue", allOf(startsWith("my"), containsString("Val")))</pre>
 */
@Factory
public static <T> Matcher<T> allOf(Iterable<Matcher<? super T>> matchers) {
  return new AllOf<T>(matchers);
}

代码示例来源:origin: google/j2objc

/**
 * Creates a matcher that always matches, regardless of the examined object.
 */
@Factory
public static Matcher<Object> anything() {
  return new IsAnything<Object>();
}

代码示例来源:origin: google/j2objc

/**
 * Creates a matcher that matches if the examined object matches <b>ANY</b> of the specified matchers.
 * <p/>
 * For example:
 * <pre>assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))</pre>
 */
@Factory
public static <T> AnyOf<T> anyOf(Matcher<? super T>... matchers) {
  return anyOf(Arrays.asList(matchers));
}

代码示例来源:origin: google/j2objc

/**
 * Creates a matcher that matches only when the examined object is the same instance as
 * the specified target object.
 *
 * @param target
 *     the target instance against which others should be assessed
 */
@Factory
public static <T> Matcher<T> sameInstance(T target) {
  return new IsSame<T>(target);
}

代码示例来源:origin: google/j2objc

/**
   * Creates a matcher that matches only when the examined object is the same instance as
   * the specified target object.
   *
   * @param target
   *     the target instance against which others should be assessed
   */
  @Factory
  public static <T> Matcher<T> theInstance(T target) {
    return new IsSame<T>(target);
  }
}

代码示例来源:origin: google/j2objc

@Factory
public static <T extends Throwable> Matcher<T> isThrowable(
    Matcher<T> throwableMatcher) {
  return new StacktracePrintingMatcher<T>(throwableMatcher);
}

代码示例来源:origin: google/j2objc

/**
 * Creates a matcher that matches when both of the specified matchers match the examined object.
 * <p/>
 * For example:
 * <pre>assertThat("fab", both(containsString("a")).and(containsString("b")))</pre>
 */
@Factory
public static <LHS> CombinableBothMatcher<LHS> both(Matcher<? super LHS> matcher) {
 return new CombinableBothMatcher<LHS>(matcher);
}

代码示例来源:origin: LMAX-Exchange/disruptor

@Factory
public static RingBufferEventMatcher ringBufferWithEvents(final Matcher<?>... valueMatchers)
{
  return new RingBufferEventMatcher(valueMatchers);
}

代码示例来源:origin: LMAX-Exchange/disruptor

@Factory
public static RingBufferEventMatcher ringBufferWithEvents(final Object... values)
{
  Matcher<?>[] valueMatchers = new Matcher[values.length];
  for (int i = 0; i < values.length; i++)
  {
    final Object value = values[i];
    valueMatchers[i] = is(value);
  }
  return new RingBufferEventMatcher(valueMatchers);
}

代码示例来源:origin: neo4j/neo4j

@Factory
public static Matcher<String> endsWith( String pattern )
{
  return new RegExp( pattern, MatchType.end );
}

代码示例来源:origin: neo4j/neo4j

@Factory
public static Matcher matchesPattern( Pattern pattern )
{
  return new RegularExpressionMatcher( pattern );
}

代码示例来源:origin: neo4j/neo4j

@Factory
  public static <T> Contains<T> contains( T... expectedItems )
  {
    return new Contains<>( expectedItems );
  }
}

代码示例来源:origin: neo4j/neo4j

@Factory
  public static Matcher matchesPattern( String pattern )
  {
    return new RegularExpressionMatcher( pattern );
  }
}

相关文章

Factory类方法