### Question:
SeriesTableView extends Control { public final ObservableList<Series<X, Y>> getData() { return dataProperty().get(); } SeriesTableView();  SeriesTableView(Series<X, Y> series);  SeriesTableView(ObservableList<Series<X, Y>> seriesList);  SeriesTableView(ObservableValue<ObservableList<Series<X, Y>>> value); final ObjectProperty<ObservableList<Series<X, Y>>> dataProperty(); final ObservableList<Series<X, Y>> getData(); final void setData(ObservableList<Series<X, Y>> value); void setXFormatter(StringConverter<X> formatter); StringConverter<X> getXFormatter(); void setXFormatter(StringConverter<X> formatter, Series<X, Y> series); StringConverter<X> getXFormatter(Series<X, Y> series); void setYFormatter(StringConverter<Y> formatter); StringConverter<Y> getYFormatter(); void setYFormatter(StringConverter<Y> formatter, Series<X, Y> series); StringConverter<Y> getYFormatter(Series<X, Y> series); static final String STYLE_CLASS; }### Answer:
@Test public void testEmptyView() { SeriesTableView<Number, Number> view = initSkin(new SeriesTableView<>()); assertNotNull(view.getData()); assertEquals("#", getTableView(view).getColumns().get(0).getText()); }
@Test public void testSingleSeriesRows() { SeriesTableView<Number, Number> view = initSkin(new SeriesTableView<>(SERIES1)); TableView<?> tableView = getTableView(view); assertEquals(SERIES1.getData().size(), tableView.getItems().size()); assertEquals(SERIES1.getData().get(0).getXValue(), getXColumn(view, 1).getCellData(0)); assertEquals(SERIES1.getData().get(0).getYValue(), getYColumn(view, 1).getCellData(0)); }
@Test public void testSeriesListRows() { ObservableList<Series<Number, Number>> seriesList = FXCollections.observableArrayList(); seriesList.add(SERIES1); SeriesTableView<Number, Number> view = initSkin(new SeriesTableView<>(seriesList)); assertEquals(SERIES1.getData().size(), getTableView(view).getItems().size()); seriesList.add(SERIES2); assertEquals(SERIES2.getData().size(), getTableView(view).getItems().size()); assertEquals(SERIES1.getData().get(0).getXValue(), getXColumn(view, 1).getCellData(0)); assertEquals(SERIES2.getData().get(1).getYValue(), getYColumn(view, 2).getCellData(1)); }
@Test public void testDataChangeReflectedInTable() { Series<Number, Number> series = createSeries1(); SeriesTableView<Number, Number> view = initSkin(new SeriesTableView<>(series)); Data<Number, Number> data = series.getData().get(0); data.setXValue(66); data.setYValue(77); assertEquals(data.getXValue(), getXColumn(view, 1).getCellData(0)); assertEquals(data.getYValue(), getYColumn(view, 1).getCellData(0)); }