public static <T> void assertMismatchDescription( String expected, Matcher<? super T> matcher, T arg) { assertFalse("Precondtion: Matcher should not match item.", matcher.matches(arg)); Description description = new StringDescription(); matcher.describeMismatch(arg, description); assertEquals("Expected mismatch description", expected, description.toString().trim()); }
/** Returns a recursively created XML representation of this <code>Meta</code>. */ public String toString() { StringBuilder buffer = new StringBuilder(); buffer.append("<" + xmltag + ">" + newline); if (null != corpus_id) { buffer.append("\t\t\t" + corpus_id.toString()); } if (null != history) { buffer.append("\t\t\t" + history.toString()); } if (null != format) { buffer.append("\t\t\t" + format.toString()); } if (null != name) { buffer.append("\t\t\t" + name.toString()); } if (null != author) { buffer.append("\t\t\t" + author.toString()); } if (null != date) { buffer.append("\t\t\t" + date.toString()); } if (null != description) { buffer.append("\t\t\t" + description.toString()); } buffer.append("\t\t</" + xmltag + ">" + newline); return buffer.toString(); }
public static void assertDescription(String expected, Matcher<?> matcher) { Description description = new StringDescription(); description.appendDescriptionOf(matcher); assertEquals("Expected description", expected, description.toString().trim()); }