SlideshowFXHandler extends StreamHandler { public String getLatestLog() { return latestLog; } SlideshowFXHandler(); void addPropertyChangeListener(PropertyChangeListener listener); void removePropertyChangeListener(PropertyChangeListener listener); String getLatestLog(); synchronized String getAllLogs(); @Override synchronized void publish(LogRecord record);  }
@Test @DisplayName("should contain the proper latest log") void correctLatestLog() { LOGGER.info("First message"); LOGGER.info("Second message"); assertTrue(handler.getLatestLog().contains("INFO: Second message")); }
@Test @DisplayName("doesn't contain the latest log if the log level doesn't allow it") void logLevelTooHighForLatestLog() { LOGGER.setLevel(WARNING); LOGGER.info("Should not be logged"); assertNull(handler.getLatestLog()); }