/** * Creates a {@link Matcher} that matches if the {@link LoggerRule} has a {@link LogRecord} * with a message matching the specified matcher. * You must have first called {@link #capture}. * * @param message the matcher to match against {@link LogRecord#getMessage} */ public static Matcher<LoggerRule> recorded(@Nonnull Matcher<String> message) { return recorded(null, message); }
/** * Creates a {@link Matcher} that matches if the {@link LoggerRule} has a {@link LogRecord} at * the specified {@link Level} and with a message matching the specified matcher. * You must have first called {@link #capture}. * * @param level The {@link Level} of the {@link LoggerRule} to match. Pass {@code null} to match any {@link Level}. * @param message The matcher to match against {@link LogRecord#getMessage}. */ public static Matcher<LoggerRule> recorded(@CheckForNull Level level, @Nonnull Matcher<String> message) { return recorded(level, message, null); }
/** * Creates a {@link Matcher} that matches if the {@link LoggerRule} has a {@link LogRecord} * with a message matching the specified matcher and with a {@link Throwable} matching the specified * matcher. * You must have first called {@link #capture}. * * @param message the matcher to match against {@link LogRecord#getMessage} * @param thrown the matcher to match against {@link LogRecord#getThrown()}. Passing {@code null} is equivalent to * passing {@link org.hamcrest.CoreMatchers#anything} */ public static Matcher<LoggerRule> recorded(@Nonnull Matcher<String> message, @CheckForNull Matcher<Throwable> thrown) { return recorded(null, message, thrown); }