ConfigurationContext extends GraphicalContext<BorderPane> { static ChoiceBox<GameButtonOrientation> buildGameButtonOrientationChooser( Configuration configuration ) { ChoiceBox<GameButtonOrientation> choiceBox = new ChoiceBox<>(); choiceBox.getItems().addAll(GameButtonOrientation.values()); GameButtonOrientation selectedValue = findSelectedGameButtonOrientation(configuration); choiceBox.getSelectionModel().select(selectedValue); choiceBox.setPrefWidth(PREF_WIDTH); choiceBox.setPrefHeight(PREF_HEIGHT); choiceBox.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> { final String newPropertyValue = newValue.name(); configuration.getMenuButtonsOrientationProperty().setValue(newPropertyValue); }); return choiceBox; } ConfigurationContext(GazePlay gazePlay); @Override ObservableList<Node> getChildren();  }
@Test void shouldBuildGameButtonOrientationChooser() { StringProperty buttonOrientationProperty = new SimpleStringProperty("HORIZONTAL"); when(mockConfig.getMenuButtonsOrientationProperty()).thenReturn(buttonOrientationProperty); when(mockConfig.getMenuButtonsOrientation()).thenReturn(buttonOrientationProperty.getValue()); ChoiceBox<GameButtonOrientation> result = ConfigurationContext.buildGameButtonOrientationChooser(mockConfig); assertEquals(2, result.getItems().size()); result.setValue(GameButtonOrientation.VERTICAL); assertEquals("VERTICAL", buttonOrientationProperty.getValue()); }