コード例 #1
0
 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());
 }
コード例 #2
0
  /** 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();
  }
コード例 #3
0
 public static void assertDescription(String expected, Matcher<?> matcher) {
   Description description = new StringDescription();
   description.appendDescriptionOf(matcher);
   assertEquals("Expected description", expected, description.toString().trim());
 }