IsNegative extends TypeSafeMatcher<N> { @Override protected void describeMismatchSafely(final N item, final Description mismatchDescription) { mismatchDescription.appendValue(item).appendText(" is not negative"); }  static Matcher<N> negative(); @Override void describeTo(final Description description);  }
@Test public void testDescribeMismatchSafely() throws Exception { assertHasMismatchDescription("<0> is not negative", isNegativeMatcher, (byte) 0); assertHasMismatchDescription("<0s> is not negative", isNegativeMatcher, (short) 0); assertHasMismatchDescription("<0> is not negative", isNegativeMatcher, 0); assertHasMismatchDescription("<0L> is not negative", isNegativeMatcher, 0L); assertHasMismatchDescription("<0> is not negative", isNegativeMatcher, new BigInteger("0")); assertHasMismatchDescription("<0> is not negative", isNegativeMatcher, new AtomicInteger(0)); assertHasMismatchDescription("<0> is not negative", isNegativeMatcher, new AtomicLong(0L)); assertHasMismatchDescription("<0.0F> is not negative", isNegativeMatcher, .0F); assertHasMismatchDescription("<0.0> is not negative", isNegativeMatcher, .0D); assertHasMismatchDescription("<0.0> is not negative", isNegativeMatcher, new BigDecimal(".0")); }