### Question:
SeriesGenerator { public Series<Object, Integer> generateSeries(JudgmentSeriesCriteria judgmentSeriesCriteria, XSettings xsettings) { Preconditions.checkNotNull(judgmentSeriesCriteria); Preconditions.checkNotNull(xsettings); JudgmentCriteria judgmentCriteria = judgmentSeriesCriteriaConverter.convert(judgmentSeriesCriteria); SolrQuery query = judgmentSearchQueryFactory.createQuery(judgmentCriteria, new Paging(0, 0)); xSettingsToQueryApplier.applyXSettingsToQuery(query, xsettings); QueryResponse response = solrQueryExecutor.executeQuery(query); Series<Object, Integer> series = seriesResultConverter.convert(response, xsettings); return series; }  Series<Object, Integer> generateSeries(JudgmentSeriesCriteria judgmentSeriesCriteria, XSettings xsettings); @Autowired void setJudgmentSeriesCriteriaConverter(JudgmentSeriesCriteriaConverter judgmentSeriesCriteriaConverter); @Autowired void setJudgmentSearchQueryFactory(SearchQueryFactory<JudgmentCriteria> judgmentSearchQueryFactory); @Autowired void setxSettingsToQueryApplier(XSettingsToQueryApplier xSettingsToQueryApplier); @Autowired void setSeriesResultConverter(SeriesResultConverter seriesResultsConverter); @Autowired void setSolrQueryExecutor(SolrQueryExecutor solrQueryExecutor);  }### Answer:
@Test public void generateSeries() { JudgmentSeriesCriteria judgmentSeriesCriteria = new JudgmentSeriesCriteria(); judgmentSeriesCriteria.setPhrase("phrase"); JudgmentCriteria judgmentCriteria = new JudgmentCriteria("all"); SolrQuery solrQuery = new SolrQuery(); QueryResponse response = new QueryResponse(); XSettings xsettings = new XSettings(); xsettings.setField(XField.JUDGMENT_DATE); Series<Object, Integer> series = new Series<Object, Integer>(); when(judgmentSeriesCriteriaConverter.convert(judgmentSeriesCriteria)).thenReturn(judgmentCriteria); when(judgmentSearchQueryFactory.createQuery(judgmentCriteria, new Paging(0, 0))).thenReturn(solrQuery); when(seriesResultConverter.convert(response, xsettings)).thenReturn(series); when(solrQueryExecutor.executeQuery(solrQuery)).thenReturn(response); Series<Object, Integer> retSeries = seriesGenerator.generateSeries(judgmentSeriesCriteria, xsettings); assertTrue(retSeries == series); verify(judgmentSeriesCriteriaConverter).convert(judgmentSeriesCriteria); verify(judgmentSearchQueryFactory).createQuery(judgmentCriteria, new Paging(0, 0)); verify(xSettingsToQueryApplier).applyXSettingsToQuery(solrQuery, xsettings); verify(seriesResultConverter).convert(response, xsettings); verify(solrQueryExecutor).executeQuery(solrQuery); }
@Test(expected = NullPointerException.class) public void generateSeries_NULL_CRITERIA() { seriesGenerator.generateSeries(null, new XSettings()); }
@Test(expected = NullPointerException.class) public void generateSeries_NULL_XSETTINGS() { seriesGenerator.generateSeries(new JudgmentSeriesCriteria(), null); }