Refine search
@Override public void describeTo(Description desc) { desc.appendText("a BeanDefinitionRegistry containing bean named ") .appendValue(beanName); }
public void describeTo(Description description) { description.appendText("exception with message "); description.appendDescriptionOf(matcher); }
@Override public void describeTo(Description buffer) { buffer.appendText("one of "); buffer.appendValueList("{", ", ", "}", collection); }
@Override public void describeTo(Description description) { description.appendText("hasProperty(").appendValue(propertyName).appendText(", ") .appendDescriptionOf(valueMatcher).appendText(")"); }
@Override public boolean matching(Matcher<T> matcher, String message) { if (matcher.matches(theValue)) { return true; } mismatch.appendText(message); matcher.describeMismatch(theValue, mismatch); return false; }
@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; }
private void describeMismatch(Matcher<? super F> matcher, F item) { mismatchDescription.appendText("item " + nextMatchIx + ": "); matcher.describeMismatch(item, mismatchDescription); } }
@Override public void describeTo(final Description description) { description.appendText("all savepoint files should have added entropy"); } };
private boolean isMatched(S item) { for (Matcher<? super S> matcher : matchers) { if (matcher.matches(item)) { matchers.remove(matcher); return true; } } mismatchDescription.appendText("Not matched: ").appendValue(item); return false; }
public void describeTo(Description description) { description.appendText("not("); first.describeTo(description); description.appendText(")"); } }
@Override public boolean matchesSafely( Diagnostic<? extends JavaFileObject> item, Description mismatchDescription) { if (!matcher.matches(item.getMessage(Locale.getDefault()))) { mismatchDescription .appendText("diagnostic message does not match ") .appendDescriptionOf(matcher); return false; } return true; }
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"; } }
private <T> void addError(String reason, T actual, Matcher<? super T> matcher) { description.appendText(reason) .appendText("\nExpected: ") .appendDescriptionOf(matcher) .appendText("\n but: "); matcher.describeMismatch(actual, description); description.appendText("\nLocation: ") .appendText(Throwables.getStackTraceAsString(new Exception())); matches = false; }
public boolean isFinished(Iterable<? extends S> items) { if (matchers.isEmpty()) { return true; } mismatchDescription .appendText("No item matches: ").appendList("", ", ", "", matchers) .appendText(" in ").appendValueList("[", ", ", "]", items); return false; }
@Override public void describeTo( Description description ) { description.appendValue( IGNORED ); } };
@Override public void describeTo(Description description) { description.appendDescriptionOf(matcher); }
@Override public void describeTo( Description description ) { description.appendValueList( "Messages[", ",", "]", messages ); } };
@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; }
public static <T> void assertThat(String reason, T actual, Matcher<? super T> matcher) { if (!matcher.matches(actual)) { Description description = new StringDescription(); description.appendText(reason) .appendText("\nExpected: ") .appendDescriptionOf(matcher) .appendText("\n but: "); matcher.describeMismatch(actual, description); throw new AssertionError(description.toString()); } }
@Override protected void describeMismatchSafely(T item, Description description) { description.appendText("cause "); causeMatcher.describeMismatch(item.getCause(), description); }