1 package unit.ui.controllers.results_controller;
3 import javafx.scene.chart.LineChart;
4 import javafx.scene.chart.XYChart;
9 import java.util.ArrayList;
10 import java.util.Date;
11 import java.util.List;
13 import static org.hamcrest.collection.IsIterableContainingInOrder.contains;
14 import static org.junit.Assert.assertThat;
28 public void testTabSwitchOnChange(){
29 clickOn(queryForPressureTab);
30 mockVoltageProvider.addValue(newVoltageDataPoint);
31 clickOn(queryForVoltageTab);
35 List<Double> voltagesOnChart = getVoltagesOnChart();
37 assertThat(voltagesOnChart, contains(newVoltageDataPoint.getValue()
41 private static void waitForFXAppToRun(){
44 }
catch (InterruptedException error){
49 private List<Double> getVoltagesOnChart(){
50 List<Double> voltages =
new ArrayList<>();
52 LineChart<String, Double> voltageChart = lookup
53 (queryForVoltageChart).query();
55 LineChart.Series<String, Double> voltageSeries = voltageChart
58 for (XYChart.Data<String, Double> voltageDataPoint: voltageSeries
61 voltages.add(voltageDataPoint.getYValue());