### Question:
SimpleControl extends GridPane implements ViewMixin { public void setField(F field) { if (this.field != null) { throw new IllegalStateException("Cannot change a control's field once set."); } this.field = field; init(); }  void setField(F field); @Override void initializeParts(); @Override void layoutParts(); void setupBindings(); @Override void setupValueChangedListeners(); void addStyleClass(String name); void removeStyleClass(String name);  }### Answer:
@Test public void itemsTest() { MultiSelectionField<Integer> mf = Field.ofMultiSelectionType(Arrays.asList(1, 2, 3), Arrays.asList(1, 2)); SingleSelectionField<Integer> sf = Field.ofSingleSelectionType(Arrays.asList(1, 2, 3), 1); SimpleCheckBoxControl<Integer> cb = new SimpleCheckBoxControl<>(); cb.setField(mf); SimpleListViewControl<Integer> lv = new SimpleListViewControl<>(); lv.setField(mf); SimpleRadioButtonControl<Integer> rb = new SimpleRadioButtonControl<>(); rb.setField(sf); SimpleComboBoxControl<Integer> cmb = new SimpleComboBoxControl<>(); cmb.setField(sf); Assert.assertEquals(3, ((VBox) cb.getChildren().get(1)).getChildren().size()); Assert.assertTrue(((CheckBox) ((VBox) cb.getChildren().get(1)).getChildren().get(1)).isSelected()); Assert.assertEquals(3, ((ListView) lv.getChildren().get(1)).getItems().size()); Assert.assertTrue(((ListView) lv.getChildren().get(1)).getSelectionModel().isSelected(1)); Assert.assertEquals(3, ((VBox) rb.getChildren().get(1)).getChildren().size()); Assert.assertTrue(((RadioButton) ((VBox) rb.getChildren().get(1)).getChildren().get(1)).isSelected()); Assert.assertEquals(3, ((ComboBox) ((StackPane) cmb.getChildren().get(1)).getChildren().get(0)).getItems().size()); Assert.assertTrue(((ComboBox) ((StackPane) cmb.getChildren().get(1)).getChildren().get(0)).getSelectionModel().isSelected(1)); mf.items(Arrays.asList(1, 2, 3, 4, 5), Arrays.asList(0, 3)); sf.items(Arrays.asList(1, 2, 3, 4, 5), 3); Assert.assertEquals(5, ((VBox) cb.getChildren().get(1)).getChildren().size()); Assert.assertTrue(((CheckBox) ((VBox) cb.getChildren().get(1)).getChildren().get(0)).isSelected()); Assert.assertEquals(5, ((ListView) lv.getChildren().get(1)).getItems().size()); Assert.assertTrue(((ListView) lv.getChildren().get(1)).getSelectionModel().isSelected(0)); Assert.assertEquals(5, ((VBox) rb.getChildren().get(1)).getChildren().size()); Assert.assertTrue(((RadioButton) ((VBox) rb.getChildren().get(1)).getChildren().get(3)).isSelected()); Assert.assertEquals(5, ((ComboBox) ((StackPane) cmb.getChildren().get(1)).getChildren().get(0)).getItems().size()); Assert.assertTrue(((ComboBox) ((StackPane) cmb.getChildren().get(1)).getChildren().get(0)).getSelectionModel().isSelected(3)); }
@Test public void styleTest() { StringField s = Field.ofStringType("test").styleClass("test"); SimpleTextControl t = new SimpleTextControl(); t.setField(s); Assert.assertEquals(3, t.getStyleClass().size()); s.styleClass("hello", "world"); Assert.assertEquals(4, t.getStyleClass().size()); s.styleClass("hi", "world"); Assert.assertEquals(4, t.getStyleClass().size()); Assert.assertEquals("world", t.getStyleClass().get(3)); }