Class ChartTester

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
      public final T component
    • Constructor Summary

      Constructors 
      Constructor Description
      ChartTester(T component) Wrap given component for testing.
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      List<Number> getSeriesValues(int seriesIndex) Gets the values for the series at given index.
      List<Number> getSeriesValues(String seriesName) Gets the values for the series with the given name.
      Number getPointValue(int seriesIndex, String name) Gets the value of the point with given name from the series at given index.
      Number getPointValue(String seriesName, String name) Gets the value of the point with given name from the series at given index.
      void clickLegendItem(String item) Simulates a click on the item of the legend with the given text.
      void clickPoint(String seriesName, String name) Simulates a click on a point on the chart.
      void clickChart() Simulates a click on the chart, but not on legend items or points.
      • Methods inherited from class com.vaadin.testbench.unit.ComponentTester

        find, getComponent, isUsable, setModal
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ChartTester

        ChartTester(T component)
        Wrap given component for testing.
        Parameters:
        component - target component
    • Method Detail

      • getSeriesValues

         List<Number> getSeriesValues(int seriesIndex)

        Gets the values for the series at given index. At the moment only ListSeries, DataSeries and DataProviderSeries are supported. For all other series types an exception will be thrown. For DataProviderSeries Y value is expected to be a Number subtype.

        Parameters:
        seriesIndex - zero-based index of the series
        Returns:

        the list of values for the series.

      • getSeriesValues

         List<Number> getSeriesValues(String seriesName)

        Gets the values for the series with the given name. At the moment only ListSeries, DataSeries and DataProviderSeries are supported. For all other series types an exception will be thrown. For DataProviderSeries Y value is expected to be a Number subtype.

        Parameters:
        seriesName - name of the series
        Returns:

        the list of values for the series.

      • getPointValue

         Number getPointValue(int seriesIndex, String name)

        Gets the value of the point with given name from the series at given index. The name depends on the series type. For ListSeries it is expected to refer to an X-Axis category, for DataSeries it refers to the item name, for DataProviderSeries it is matched against the value of the configured x attribute. At the moment only ListSeries, DataSeries and DataProviderSeries are supported. For all other series types an exception will be thrown.

        Parameters:
        seriesIndex - zero-based index of the series
        name - name of the point in the series
        Returns:

        the value of the point at given coordinates.

      • getPointValue

         Number getPointValue(String seriesName, String name)

        Gets the value of the point with given name from the series at given index. The name depends on the series type. For ListSeries it is expected to refer to an X-Axis category, for DataSeries it refers to the item name, for DataProviderSeries it is matched against the value of the configured x attribute. At the moment only ListSeries, DataSeries and DataProviderSeries are supported. For all other series types an exception will be thrown.

        Parameters:
        seriesName - name of the series
        name - name of the point in the series
        Returns:

        the value of the point at given coordinates.

      • clickLegendItem

         void clickLegendItem(String item)

        Simulates a click on the item of the legend with the given text. Current limitation: it assumes the text corresponds to a series name.

        Parameters:
        item - legend item
      • clickPoint

         void clickPoint(String seriesName, String name)

        Simulates a click on a point on the chart.

        Parameters:
        seriesName - name of the series
        name - name of the point in the series
      • clickChart

         void clickChart()

        Simulates a click on the chart, but not on legend items or points.