@Test public void aggregateFlotSeries() { FlotSeries flotSeries = new FlotSeries(); flotSeries.addPoint(new Integer[]{0, 10}); flotSeries.addPoint(new Integer[]{1, 20}); flotSeries.addPoint(new Integer[]{2, 30}); when(aggregatedSeriesXValueGenerator.generateXValue(0)).thenReturn(1); FlotSeries aggregatedSeries = seriesAggregator.aggregateFlotSeries(flotSeries, 0); assertNotNull(aggregatedSeries); assertNotNull(aggregatedSeries.getPoints()); assertEquals(1, aggregatedSeries.getPoints().size()); assertArrayEquals(new Number[]{1, 60}, aggregatedSeries.getPoints().get(0)); }
@Override public FlotSeries aggregateFlotSeries(FlotSeries flotSeries, int flotSeriesIndex) { FlotSeries aggregatedFlotSeries = new FlotSeries(); int sum = 0; for (Number[] point : flotSeries.getPoints()) { sum += point[1].intValue(); } aggregatedFlotSeries.addPoint(new Integer[]{aggregatedSeriesXValueGenerator.generateXValue(flotSeriesIndex), sum}); return aggregatedFlotSeries; }
NumberFlotSeriesAggregator implements FlotSeriesAggregator { @Override public FlotSeries aggregateFlotSeries(FlotSeries flotSeries, int flotSeriesIndex) { FlotSeries aggregatedFlotSeries = new FlotSeries(); int sum = 0; for (Number[] point : flotSeries.getPoints()) { sum += point[1].intValue(); } aggregatedFlotSeries.addPoint(new Integer[]{aggregatedSeriesXValueGenerator.generateXValue(flotSeriesIndex), sum}); return aggregatedFlotSeries; } }
NumberFlotSeriesAggregator implements FlotSeriesAggregator { @Override public FlotSeries aggregateFlotSeries(FlotSeries flotSeries, int flotSeriesIndex) { FlotSeries aggregatedFlotSeries = new FlotSeries(); int sum = 0; for (Number[] point : flotSeries.getPoints()) { sum += point[1].intValue(); } aggregatedFlotSeries.addPoint(new Integer[]{aggregatedSeriesXValueGenerator.generateXValue(flotSeriesIndex), sum}); return aggregatedFlotSeries; }  }
NumberFlotSeriesAggregator implements FlotSeriesAggregator { @Override public FlotSeries aggregateFlotSeries(FlotSeries flotSeries, int flotSeriesIndex) { FlotSeries aggregatedFlotSeries = new FlotSeries(); int sum = 0; for (Number[] point : flotSeries.getPoints()) { sum += point[1].intValue(); } aggregatedFlotSeries.addPoint(new Integer[]{aggregatedSeriesXValueGenerator.generateXValue(flotSeriesIndex), sum}); return aggregatedFlotSeries; }  @Override FlotSeries aggregateFlotSeries(FlotSeries flotSeries, int flotSeriesIndex); @Override boolean handles(UiyValueType uiyValueType); @Autowired void setAggregatedSeriesXValueGenerator(AggregatedSeriesXValueGenerator aggregatedSeriesXValueGenerator); }
NumberFlotSeriesAggregator implements FlotSeriesAggregator { @Override public FlotSeries aggregateFlotSeries(FlotSeries flotSeries, int flotSeriesIndex) { FlotSeries aggregatedFlotSeries = new FlotSeries(); int sum = 0; for (Number[] point : flotSeries.getPoints()) { sum += point[1].intValue(); } aggregatedFlotSeries.addPoint(new Integer[]{aggregatedSeriesXValueGenerator.generateXValue(flotSeriesIndex), sum}); return aggregatedFlotSeries; }  @Override FlotSeries aggregateFlotSeries(FlotSeries flotSeries, int flotSeriesIndex); @Override boolean handles(UiyValueType uiyValueType); @Autowired void setAggregatedSeriesXValueGenerator(AggregatedSeriesXValueGenerator aggregatedSeriesXValueGenerator);  }