### Question:
LogMessageTracker { public boolean contains(Pattern regex) { return logAppender.list.stream().anyMatch(event -> regex.matcher(event.getFormattedMessage()).find()); } LogMessageTracker(Class<?> loggedClass);  LogMessageTracker(String loggerName); void startTracking(); void stopTracking(); boolean contains(Pattern regex); boolean contains(String content); boolean contains(Pattern regex, Level level); boolean contains(String content, Level level); List<ILoggingEvent> search(Pattern regex); List<ILoggingEvent> search(String content); List<ILoggingEvent> search(Pattern regex, Level level); List<ILoggingEvent> search(String content, Level level); long countEvents(); List<ILoggingEvent> getAllLoggedEvents(); List<ILoggingEvent> getAllLoggedEventsWithLevel(Level level);  }### Answer:
@Test void givenLogsAndLevelFilter_whenCheckExist_thenLogsExist() { assertTrue(logMessageTracker.contains(LOG_MESSAGE)); assertTrue(logMessageTracker.contains(LOG_MESSAGE, Level.TRACE)); assertTrue(logMessageTracker.contains(MESSAGE_REGEX)); assertTrue(logMessageTracker.contains(MESSAGE_REGEX, Level.TRACE)); }
@Test void givenLogsAndLevelFilter_whenCheckExist_thenLogsDontExist() { assertFalse(logMessageTracker.contains(NOT_LOGGED_MESSAGE)); assertFalse(logMessageTracker.contains(LOG_MESSAGE, Level.ALL)); assertFalse(logMessageTracker.contains(NOT_MESSAGE_REGEX)); assertFalse(logMessageTracker.contains(MESSAGE_REGEX, Level.ALL)); }