public static <T extends Throwable> org.hamcrest.Matcher<T> hasMessageThat(Matcher<String> stringMatcher) {
        return new ThrowableMessageMatcher<>(stringMatcher);
    }
public static < T extends Throwable > org . hamcrest . Matcher < T > hasMessageThat ( Matcher < String > stringMatcher ) { return new ThrowableMessageMatcher < > ( stringMatcher ) ; }
EXAMPLES:
<code>assertThat(caughtThrowable(), hasMessageThat(is("Index: 9, Size: 9")));
assertThat(caughtThrowable(), hasMessageThat(containsString("Index: 9"))); // using JUnitMatchers
assertThat(caughtThrowable(), hasMessageThat(containsPattern("Index: \\d+"))); // using Mockito's Find</code>

@param <T>
the throwable subclass
@param stringMatcher
a string matcher
@return Returns a matcher that matches an throwable if the given string matcher matches the throwable message.