ConfigurationContext extends GraphicalContext<BorderPane> { static ChoiceBox<EyeTracker> buildEyeTrackerConfigChooser(Configuration configuration) { ChoiceBox<EyeTracker> choiceBox = new ChoiceBox<>(); choiceBox.getItems().addAll(EyeTracker.values()); EyeTracker selectedEyeTracker = findSelectedEyeTracker(configuration); choiceBox.getSelectionModel().select(selectedEyeTracker); choiceBox.setPrefWidth(PREF_WIDTH); choiceBox.setPrefHeight(PREF_HEIGHT); choiceBox.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> { final String newPropertyValue = newValue.name(); configuration.getEyetrackerProperty().setValue(newPropertyValue); }); return choiceBox; } ConfigurationContext(GazePlay gazePlay); @Override ObservableList<Node> getChildren();  }
@Test void shouldBuildEyeTrackerChooser() { StringProperty eyeTrackerProperty = new SimpleStringProperty("mouse_control"); when(mockConfig.getEyeTracker()).thenReturn(eyeTrackerProperty.getValue()); when(mockConfig.getEyetrackerProperty()).thenReturn(eyeTrackerProperty); ChoiceBox<EyeTracker> result = ConfigurationContext.buildEyeTrackerConfigChooser(mockConfig); assertEquals(3, result.getItems().size()); result.setValue(EyeTracker.eyetribe); assertEquals("eyetribe", eyeTrackerProperty.getValue()); }