### Question:
ChartService { public Chart<Object, Number> generateChart(List<JudgmentSeriesCriteria> criteriaList, XSettings xsettings, YSettings ysettings) { Preconditions.checkNotNull(criteriaList); Preconditions.checkArgument(!criteriaList.isEmpty()); Chart<Object, Number> chart = new Chart<>(); for (JudgmentSeriesCriteria criteria : criteriaList) { Series<Object, Number> series = seriesService.generateSeries(criteria, xsettings, ysettings); chart.addSeries(series); } return chart; }  Chart<Object, Number> generateChart(List<JudgmentSeriesCriteria> criteriaList, XSettings xsettings, YSettings ysettings); @Autowired void setSeriesService(SeriesService seriesService);  }### Answer:
@Test(expected = NullPointerException.class) public void generateChart_NullCriteriaList() { chartService.generateChart(null, xsettings, ysettings); }
@Test(expected = IllegalArgumentException.class) public void generateChart_EmptyCriteriaList() { chartService.generateChart(new ArrayList<>(), xsettings, ysettings); }
@Test public void generateChart() { JudgmentSeriesCriteria criteria1 = mock(JudgmentSeriesCriteria.class); JudgmentSeriesCriteria criteria2 = mock(JudgmentSeriesCriteria.class); List<JudgmentSeriesCriteria> criteriaList = Lists.newArrayList(criteria1, criteria2); Series<Object, Number> series1 = new Series<>(); Series<Object, Number> series2 = new Series<>(); when(seriesService.generateSeries(criteria1, xsettings, ysettings)).thenReturn(series1); when(seriesService.generateSeries(criteria2, xsettings, ysettings)).thenReturn(series2); Chart<Object, Number> chart = chartService.generateChart(criteriaList, xsettings, ysettings); verify(seriesService).generateSeries(criteria1, xsettings, ysettings); verify(seriesService).generateSeries(criteria2, xsettings, ysettings); assertTrue(chart.getSeriesList().get(0) == series1); assertTrue(chart.getSeriesList().get(1) == series2); }