SlideshowFXHandler extends StreamHandler { public synchronized String getAllLogs() { String logs = ""; try { super.flush(); logs = new String(this.byteOutput.toByteArray(), this.getEncoding()); } catch (IOException e) { LOGGER.log(WARNING, "Error retrieving all logs", e); } return logs; } SlideshowFXHandler(); void addPropertyChangeListener(PropertyChangeListener listener); void removePropertyChangeListener(PropertyChangeListener listener); String getLatestLog(); synchronized String getAllLogs(); @Override synchronized void publish(LogRecord record);  }
@Test @DisplayName("returns all logs") void returnsAllLogs() { LOGGER.log(INFO, "Information message"); LOGGER.warning("Warning message"); assertTrue(handler.getAllLogs().contains("INFO: Information message")); assertTrue(handler.getAllLogs().contains("WARNING: Warning message")); }