SlideshowFXHandler extends StreamHandler { public void removePropertyChangeListener(PropertyChangeListener listener) { this.propertyChangeSupport.removePropertyChangeListener(listener); } SlideshowFXHandler(); void addPropertyChangeListener(PropertyChangeListener listener); void removePropertyChangeListener(PropertyChangeListener listener); String getLatestLog(); synchronized String getAllLogs(); @Override synchronized void publish(LogRecord record);  }
@Test @DisplayName("allows to remove a PropertyChangeListener for the latest log") void removePropertyChangeListener() { final CompletableFuture<Boolean> eventFired = new CompletableFuture<>(); final PropertyChangeListener listener = event -> eventFired.completeExceptionally(new IllegalStateException("Event shouldn't be fired")); handler.addPropertyChangeListener(listener); handler.removePropertyChangeListener(listener); LOGGER.info("Don't fire event"); assertThrows(TimeoutException.class, () -> eventFired.get(5, SECONDS)); }