本文整理了Java中org.hamcrest.Matcher.describeMismatch()
方法的一些代码示例,展示了Matcher.describeMismatch()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Matcher.describeMismatch()
方法的具体详情如下:
包路径:org.hamcrest.Matcher
类名称:Matcher
方法名:describeMismatch
[英]Generate a description of why the matcher has not accepted the item. The description will be part of a larger description of why a matching failed, so it should be concise. This method assumes that matches(item)
is false, but will not check this.
[中]生成匹配者未接受项目的原因说明。该描述将是匹配失败原因的更大描述的一部分,因此应该简洁。此方法假定matches(item)
为false,但不会对此进行检查。
代码示例来源:origin: org.hamcrest/hamcrest-all
private void describeMismatch(Matcher<? super F> matcher, F item) {
mismatchDescription.appendText("item " + nextMatchIx + ": ");
matcher.describeMismatch(item, mismatchDescription);
}
}
代码示例来源:origin: junit-team/junit4
@Override
protected void describeMismatchSafely(T item, Description description) {
description.appendText("cause ");
causeMatcher.describeMismatch(item.getCause(), description);
}
代码示例来源:origin: junit-team/junit4
@Override
protected void describeMismatchSafely(T item, Description description) {
description.appendText("message ");
matcher.describeMismatch(item.getMessage(), description);
}
代码示例来源:origin: google/j2objc
@Override
public boolean matching(Matcher<T> matcher, String message) {
if (matcher.matches(theValue)) {
return true;
}
mismatch.appendText(message);
matcher.describeMismatch(theValue, mismatch);
return false;
}
代码示例来源:origin: google/j2objc
@Override
protected void describeMismatchSafely(T item, Description description) {
description.appendText("message ");
fMatcher.describeMismatch(item.getMessage(), description);
}
代码示例来源:origin: google/j2objc
@Override
protected void describeMismatchSafely(T item, Description description) {
description.appendText("cause ");
fMatcher.describeMismatch(item.getCause(), description);
}
代码示例来源:origin: google/j2objc
@Override
public boolean matchesSafely(Iterable<T> collection, Description mismatchDescription) {
for (T t : collection) {
if (!matcher.matches(t)) {
mismatchDescription.appendText("an item ");
matcher.describeMismatch(t, mismatchDescription);
return false;
}
}
return true;
}
代码示例来源:origin: org.hamcrest/hamcrest-all
@Override
public boolean matches(Object actual, Description mismatch) {
final Object actualValue = readProperty(readMethod, actual);
if (!matcher.matches(actualValue)) {
mismatch.appendText(propertyName + " ");
matcher.describeMismatch(actualValue, mismatch);
return false;
}
return true;
}
代码示例来源:origin: org.hamcrest/hamcrest-all
@Override
public boolean matching(Matcher<T> matcher, String message) {
if (matcher.matches(theValue)) {
return true;
}
mismatch.appendText(message);
matcher.describeMismatch(theValue, mismatch);
return false;
}
代码示例来源:origin: org.hamcrest/hamcrest-all
@Override
public boolean matchesSafely(Iterable<T> collection, Description mismatchDescription) {
for (T t : collection) {
if (!matcher.matches(t)) {
mismatchDescription.appendText("an item ");
matcher.describeMismatch(t, mismatchDescription);
return false;
}
}
return true;
}
代码示例来源:origin: google/j2objc
@Override
public boolean matches(Object o, Description mismatch) {
for (Matcher<? super T> matcher : matchers) {
if (!matcher.matches(o)) {
mismatch.appendDescriptionOf(matcher).appendText(" ");
matcher.describeMismatch(o, mismatch);
return false;
}
}
return true;
}
代码示例来源:origin: org.hamcrest/hamcrest-all
@Override
public boolean matches(Object o, Description mismatch) {
for (Matcher<? super T> matcher : matchers) {
if (!matcher.matches(o)) {
mismatch.appendDescriptionOf(matcher).appendText(" ");
matcher.describeMismatch(o, mismatch);
return false;
}
}
return true;
}
代码示例来源:origin: google/j2objc
@Override
protected boolean matchesSafely(Iterable<? super T> collection, Description mismatchDescription) {
boolean isPastFirst = false;
for (Object item : collection) {
if (elementMatcher.matches(item)){
return true;
}
if (isPastFirst) {
mismatchDescription.appendText(", ");
}
elementMatcher.describeMismatch(item, mismatchDescription);
isPastFirst = true;
}
return false;
}
代码示例来源:origin: org.hamcrest/hamcrest-all
@Override
protected boolean matchesSafely(Iterable<? super T> collection, Description mismatchDescription) {
boolean isPastFirst = false;
for (Object item : collection) {
if (elementMatcher.matches(item)){
return true;
}
if (isPastFirst) {
mismatchDescription.appendText(", ");
}
elementMatcher.describeMismatch(item, mismatchDescription);
isPastFirst = true;
}
return false;
}
代码示例来源:origin: hamcrest/JavaHamcrest
@Override
public boolean matchesSafely(Iterable<? extends T> collection, Description mismatchDescription) {
for (T t : collection) {
if (!matcher.matches(t)) {
mismatchDescription.appendText("an item ");
matcher.describeMismatch(t, mismatchDescription);
return false;
}
}
return true;
}
代码示例来源:origin: hamcrest/JavaHamcrest
@Override
public boolean matching(Matcher<T> matcher, String message) {
if (matcher.matches(theValue)) {
return true;
}
mismatch.appendText(message);
matcher.describeMismatch(theValue, mismatch);
return false;
}
代码示例来源:origin: hamcrest/JavaHamcrest
@Override
public boolean matches(Object actual, Description mismatch) {
final Object actualValue = readProperty(readMethod, actual);
if (!matcher.matches(actualValue)) {
mismatch.appendText(propertyName + " ");
matcher.describeMismatch(actualValue, mismatch);
return false;
}
return true;
}
代码示例来源:origin: junit-team/junit4
@Override
protected void describeMismatchSafely(T item, Description description) {
throwableMatcher.describeMismatch(item, description);
description.appendText("\nStacktrace was: ");
description.appendText(readStacktrace(item));
}
代码示例来源:origin: querydsl/querydsl
@Override
protected boolean matchesSafely(T bean, Description mismatchDescription) {
V value = accessor.apply(bean);
boolean valueMatches = matcher.matches(value);
if (!valueMatches) {
mismatchDescription.appendText("value \"" + path.toString() + "\" ");
matcher.describeMismatch(value, mismatchDescription);
}
return valueMatches;
}
代码示例来源:origin: hamcrest/JavaHamcrest
@Override
public boolean matches(Object o, Description mismatch) {
for (Matcher<? super T> matcher : matchers) {
if (!matcher.matches(o)) {
mismatch.appendDescriptionOf(matcher).appendText(" ");
matcher.describeMismatch(o, mismatch);
return false;
}
}
return true;
}
内容来源于网络,如有侵权,请联系作者删除!