@Test void shouldHaveNotMoreValuesThatAllowed() { SeverityTrendChart chart = new SeverityTrendChart(); ChartModelConfiguration configuration = mock(ChartModelConfiguration.class); when(configuration.getBuildCount()).thenReturn(3); when(configuration.getAxisType()).thenReturn(AxisType.BUILD); when(configuration.isBuildCountDefined()).thenReturn(true); List<BuildResult<AnalysisBuildResult>> results = new ArrayList<>(); results.add(createResult(4, 4000, 400, 40, 4)); results.add(createResult(3, 3000, 300, 30, 3)); results.add(createResult(2, 2000, 200, 20, 2)); results.add(createResult(1, 1000, 100, 10, 1)); LinesChartModel model = chart.create(results, configuration); verifySeries(model.getSeries().get(3), Severity.ERROR, 2000, 3000, 4000); verifySeries(model.getSeries().get(2), Severity.WARNING_HIGH, 200, 300, 400); verifySeries(model.getSeries().get(1), Severity.WARNING_NORMAL, 20, 30, 40); verifySeries(model.getSeries().get(0), Severity.WARNING_LOW, 2, 3, 4); assertThatJson(model).node("domainAxisLabels") .isArray().hasSize(3).containsExactly("#2", "#3", "#4"); assertThatJson(model).node("buildNumbers") .isArray().hasSize(3).containsExactly(2, 3, 4); assertThatJson(model).node("series") .isArray().hasSize(4); }
@Override public LinesChartModel create(final Iterable<? extends BuildResult<AnalysisBuildResult>> results, final ChartModelConfiguration configuration) { SeveritySeriesBuilder builder = new SeveritySeriesBuilder(); LinesDataSet dataSet = builder.createDataSet(configuration, results); return createChartFromDataSet(dataSet); }
SeverityTrendChart implements TrendChart { @Override public LinesChartModel create(final Iterable<? extends BuildResult<AnalysisBuildResult>> results, final ChartModelConfiguration configuration) { SeveritySeriesBuilder builder = new SeveritySeriesBuilder(); LinesDataSet dataSet = builder.createDataSet(configuration, results); return createChartFromDataSet(dataSet); } }
SeverityTrendChart implements TrendChart { @Override public LinesChartModel create(final Iterable<? extends BuildResult<AnalysisBuildResult>> results, final ChartModelConfiguration configuration) { SeveritySeriesBuilder builder = new SeveritySeriesBuilder(); LinesDataSet dataSet = builder.createDataSet(configuration, results); return createChartFromDataSet(dataSet); }  }
SeverityTrendChart implements TrendChart { @Override public LinesChartModel create(final Iterable<? extends BuildResult<AnalysisBuildResult>> results, final ChartModelConfiguration configuration) { SeveritySeriesBuilder builder = new SeveritySeriesBuilder(); LinesDataSet dataSet = builder.createDataSet(configuration, results); return createChartFromDataSet(dataSet); }  @Override LinesChartModel create(final Iterable<? extends BuildResult<AnalysisBuildResult>> results,
            final ChartModelConfiguration configuration); LinesChartModel aggregate(final List<Iterable<? extends BuildResult<AnalysisBuildResult>>> results,
            final ChartModelConfiguration configuration); }
SeverityTrendChart implements TrendChart { @Override public LinesChartModel create(final Iterable<? extends BuildResult<AnalysisBuildResult>> results, final ChartModelConfiguration configuration) { SeveritySeriesBuilder builder = new SeveritySeriesBuilder(); LinesDataSet dataSet = builder.createDataSet(configuration, results); return createChartFromDataSet(dataSet); }  @Override LinesChartModel create(final Iterable<? extends BuildResult<AnalysisBuildResult>> results,
            final ChartModelConfiguration configuration); LinesChartModel aggregate(final List<Iterable<? extends BuildResult<AnalysisBuildResult>>> results,
            final ChartModelConfiguration configuration);  }