ConfigurationContext extends GraphicalContext<BorderPane> { HomeButton createHomeButtonInConfigurationManagementScreen(@NonNull GazePlay gazePlay) { Dimension2D screenDimension = gazePlay.getCurrentScreenDimensionSupplier().get(); HomeButton homeButton = new HomeButton(screenDimension); EventHandler<Event> homeEvent = e -> { if (e.getEventType() == MouseEvent.MOUSE_CLICKED) { root.setCursor(Cursor.WAIT); gazePlay.onReturnToMenu(); root.setCursor(Cursor.DEFAULT); } }; homeButton.addEventHandler(MouseEvent.MOUSE_CLICKED, homeEvent); return homeButton; } ConfigurationContext(GazePlay gazePlay); @Override ObservableList<Node> getChildren();  }
@Test void shouldReturnToMenuOnHomeButtonPress() throws InterruptedException { Platform.runLater(() -> { ConfigurationContext context = new ConfigurationContext(mockGazePlay); HomeButton button = context.createHomeButtonInConfigurationManagementScreen(mockGazePlay); button.fireEvent(TestingUtils.clickOnTarget(button)); verify(mockGazePlay).onReturnToMenu(); }); TestingUtils.waitForRunLater(); }