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