ConfigurationContext extends GraphicalContext<BorderPane> { ChoiceBox<Double> buildHeatMapOpacityChoiceBox(Configuration config) { ChoiceBox<Double> choiceBox = new ChoiceBox<>(); for (double i = 0; i <= 10; i++) { choiceBox.getItems().add(i / 10); } choiceBox.getSelectionModel().select(config.getHeatMapOpacity()); choiceBox.setPrefSize(PREF_WIDTH, PREF_HEIGHT); choiceBox.getSelectionModel().selectedItemProperty() .addListener((observableValue, oldValue, newValue) -> config.getHeatMapOpacityProperty().setValue(newValue)); return choiceBox; } ConfigurationContext(GazePlay gazePlay); @Override ObservableList<Node> getChildren();  }
@Test void shouldBuildHeatMapOpacityChoiceBox() throws InterruptedException { Platform.runLater(() -> { ConfigurationContext context = new ConfigurationContext(mockGazePlay); DoubleProperty heatMapProperty = new SimpleDoubleProperty(1); when(mockConfig.getHeatMapOpacityProperty()).thenReturn(heatMapProperty); when(mockConfig.getHeatMapOpacity()).thenReturn(heatMapProperty.getValue()); ChoiceBox<Double> result = context.buildHeatMapOpacityChoiceBox(mockConfig); assertEquals(11, result.getItems().size()); result.setValue(0.2); assertEquals(0.2, heatMapProperty.getValue()); }); TestingUtils.waitForRunLater(); }