private String getMatchMessage(Callable<T> supplier, Matcher<? super T> matcher) { return String.format("%s reached its end value of %s", getCallableDescription(supplier), HamcrestToStringFilter.filter(matcher)); }
private String getMismatchMessage(Callable<T> supplier, Matcher<? super T> matcher) { Description mismatchDescription = new StringDescription(); matcher.describeMismatch(lastResult, mismatchDescription); if (mismatchDescription.toString() != null && mismatchDescription.toString().isEmpty()) { mismatchDescription.appendText("was ").appendValue(lastResult); } return String.format("%s expected %s but %s", getCallableDescription(supplier), HamcrestToStringFilter.filter(matcher), mismatchDescription); }
@Test public void removesAllNotNotsFromToString() throws Exception { assertEquals("<4>", HamcrestToStringFilter.filter(not(not(not(not((equalTo(4)))))))); }
@Test public void removesNotNotButKeepsRemainingNotFromToString() throws Exception { assertEquals("not <4>", HamcrestToStringFilter.filter(not(not(not((equalTo(4))))))); } }
@Test public void removesNotNotFromToString() throws Exception { assertEquals("<4>", HamcrestToStringFilter.filter(not(not((equalTo(4)))))); }
@Test public void removesIsFromToString() throws Exception { assertEquals("<4>", HamcrestToStringFilter.filter(is(equalTo(4)))); }
private String getMatchMessage(Callable<T> supplier, Matcher<? super T> matcher) { return String.format("%s reached its end value of %s", getCallableDescription(supplier), HamcrestToStringFilter.filter(matcher)); }
private String getMismatchMessage(Callable<T> supplier, Matcher<? super T> matcher) { Description mismatchDescription = new StringDescription(); matcher.describeMismatch(lastResult, mismatchDescription); if (mismatchDescription.toString() != null && mismatchDescription.toString().isEmpty()) { mismatchDescription.appendText("was ").appendValue(lastResult); } return String.format("%s expected %s but %s", getCallableDescription(supplier), HamcrestToStringFilter.filter(matcher), mismatchDescription); }