public void describeTo(Description description) { throwableMatcher.describeTo(description); }
public void describeTo(Description description) { fThrowableMatcher.describeTo(description); }
public void describeTo(Description description) { actualMatcher.describeTo(description); }
public void describeTo(Description description) { description.appendText("has failure with exception matching "); matcher.describeTo(description); } };
public void describeTo(Description description) { description.appendText("not("); first.describeTo(description); description.appendText(")"); } }
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(")"); } }
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(")"); } }
@Override public void describeTo( Description description ) { inner.describeTo( description ); } };
private String describeMatcher() { Description d = new StringDescription(); matcher.describeTo(d); return d.toString(); } }
@Override public void describeTo(Description description) { matcher.describeTo(description); }
@Override public void appendTo(StringBuffer buffer) { hamcrestMatcher.describeTo(new StringDescription(buffer)); } }
@Override public StringBuffer describeTo(StringBuffer buffer) { hamcrestMatcher.describeTo(new StringDescription(buffer)); return buffer; } }
@Override public void describeTo(final Description description) { description.appendText("Expected ring buffer with events matching: "); for (Matcher<?> expectedValueMatcher : expectedValueMatchers) { expectedValueMatcher.describeTo(description); } } }
@Override public void describeTo(Description description) { description.appendText("with hint: "); stringMatcher.describeTo(description); } };
public void describeTo(Description desc) { desc.appendText("getCause() "); causeInstance.describeTo(desc); desc.appendText("getCause().getDataCode() "); causeDataCode.describeTo(desc); } });
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"; } }
@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>")); }
@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)); }
@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)); }
@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)); }