ExceptionWitnessResponderButton extends Button { @Subscribe public void onExceptionEvent(ExceptionEvent event) { if (getScene() == null || getScene().getRoot() == null) { return; } if (event.getOrigin().equals(origin)) { Platform.runLater(() -> { tooltip.setText(WordUtils.wrap(event.getMessage(), 90, null, true)); getPopover().assignFromExceptionEvent(event); this.setVisible(true); }); } } @Inject  ExceptionWitnessResponderButton(@Assisted Object origin, @Assisted String popOverTitle); @Subscribe void onExceptionEvent(ExceptionEvent event); @Subscribe void onExceptionClearedEvent(ExceptionClearedEvent event);  }
@Test public void testOnExceptionEvent() throws Exception { flagNewException(); WaitForAsyncUtils.waitFor(2, TimeUnit.SECONDS, () -> NodeMatchers.isVisible().matches(lookup("." + ExceptionWitnessResponderButton .STYLE_CLASS).query())); }