### Question:
LogMessageTracker { public List<ILoggingEvent> search(Pattern regex) { return logAppender.list.stream() .filter(event -> regex.matcher(event.getFormattedMessage()).find()) .collect(Collectors.toList()); } 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_whenSearch_thenFindLogs() { assertEquals(5, logMessageTracker.search(LOG_MESSAGE).size()); assertEquals(1, logMessageTracker.search(LOG_MESSAGE, Level.INFO).size()); assertEquals(5, logMessageTracker.search(MESSAGE_REGEX).size()); assertEquals(1, logMessageTracker.search(MESSAGE_REGEX, Level.INFO).size()); }
@Test void givenLogsAndLevelFilter_whenSearch_thenFindNoLogs() { assertEquals(0, logMessageTracker.search(NOT_LOGGED_MESSAGE).size()); assertEquals(0, logMessageTracker.search(LOG_MESSAGE, Level.ALL).size()); assertEquals(0, logMessageTracker.search(NOT_MESSAGE_REGEX).size()); assertEquals(0, logMessageTracker.search(MESSAGE_REGEX, Level.ALL).size()); }