org.hamcrest.Matcher.describeTo()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(4.9k)|赞(0)|评价(0)|浏览(95)

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

Matcher.describeTo介绍

暂无

代码示例

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

public void describeTo(Description description) {
  throwableMatcher.describeTo(description);
}

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

public void describeTo(Description description) {
  fThrowableMatcher.describeTo(description);
}

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

public void describeTo(Description description) {
  actualMatcher.describeTo(description);
}

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

public void describeTo(Description description) {
    description.appendText("has failure with exception matching ");
    matcher.describeTo(description);
  }
};

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

public void describeTo(Description description) {
    description.appendText("not(");
    first.describeTo(description);
    description.appendText(")");
  }
}

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

public void describeTo(Description description) {
    description.appendText("and(");
    for (Iterator<Matcher> it = matchers.iterator(); it.hasNext();) {
      it.next().describeTo(description);
      if (it.hasNext()) {
        description.appendText(", ");
      }
    }
    description.appendText(")");
  }
}

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

public void describeTo(Description description) {
    description.appendText("or(");
    for (Iterator<Matcher> it = matchers.iterator(); it.hasNext();) {
      it.next().describeTo(description);
      if (it.hasNext()) {
        description.appendText(", ");
      }
    }
    description.appendText(")");
  }
}

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

@Override
  public void describeTo( Description description )
  {
    inner.describeTo( description );
  }
};

代码示例来源:origin: org.assertj/assertj-core

private String describeMatcher() {
  Description d = new StringDescription();
  matcher.describeTo(d);
  return d.toString();
 }
}

代码示例来源:origin: ben-manes/caffeine

@Override
public void describeTo(Description description) {
 matcher.describeTo(description);
}

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

@Override
  public void appendTo(StringBuffer buffer) {
    hamcrestMatcher.describeTo(new StringDescription(buffer));
  }
}

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

@Override
  public StringBuffer describeTo(StringBuffer buffer) {
    hamcrestMatcher.describeTo(new StringDescription(buffer));
    return buffer;
  }
}

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

@Override
  public void describeTo(final Description description)
  {
    description.appendText("Expected ring buffer with events matching: ");

    for (Matcher<?> expectedValueMatcher : expectedValueMatchers)
    {
      expectedValueMatcher.describeTo(description);
    }
  }
}

代码示例来源:origin: googlesamples/android-testing

@Override
  public void describeTo(Description description) {
    description.appendText("with hint: ");
    stringMatcher.describeTo(description);
  }
};

代码示例来源:origin: spring-projects/spring-security

public void describeTo(Description desc) {
    desc.appendText("getCause() ");
    causeInstance.describeTo(desc);
    desc.appendText("getCause().getDataCode() ");
    causeDataCode.describeTo(desc);
  }
});

代码示例来源:origin: rest-assured/rest-assured

public String buildError(T actual, M matcher) {
    final StringDescription descriptionBuilder = new StringDescription();
    descriptionBuilder.appendText("Expected ").appendText(name).appendText(" ");
    matcher.describeTo(descriptionBuilder);
    descriptionBuilder.appendText(" but ");
    matcher.describeMismatch(actual, descriptionBuilder);

    final String description = descriptionBuilder.toString().replaceAll("[.\\n]+$", "");
    return description + ".\n";
  }
}

代码示例来源:origin: json-path/JsonPath

@Test
public void shouldBeDescriptive() {
  Matcher<? super ReadContext> matcher = withJsonPath("path", equalTo(2));
  Description description = new StringDescription();
  matcher.describeTo(description);
  assertThat(description.toString(), containsString("path"));
  assertThat(description.toString(), containsString("<2>"));
}

代码示例来源:origin: json-path/JsonPath

@Test
public void shouldBeDescriptive() {
  Matcher<File> matcher = isJsonFile(withPathEvaluatedTo(true));
  Description description = new StringDescription();
  matcher.describeTo(description);
  assertThat(description.toString(), startsWith("is json"));
  assertThat(description.toString(), containsString(MATCH_TRUE_TEXT));
}

代码示例来源:origin: json-path/JsonPath

@Test
public void shouldBeDescriptive() {
  Matcher<String> matcher = isJsonString(withPathEvaluatedTo(true));
  Description description = new StringDescription();
  matcher.describeTo(description);
  assertThat(description.toString(), startsWith("is json"));
  assertThat(description.toString(), containsString(MATCH_TRUE_TEXT));
}

代码示例来源:origin: json-path/JsonPath

@Test
public void shouldBeDescriptive() {
  Matcher<Object> matcher = isJson(withPathEvaluatedTo(true));
  Description description = new StringDescription();
  matcher.describeTo(description);
  assertThat(description.toString(), startsWith("is json"));
  assertThat(description.toString(), containsString(TestingMatchers.MATCH_TRUE_TEXT));
}

相关文章