### Question:
SeriesYRateRecalculator implements SeriesYRecalculator { @Override public Series<Object, ? extends Number> recalculateSeries(Series<Object, Integer> series, JudgmentSeriesCriteria criteria, XSettings xsettings, YSettings ysettings) { RateYValue rateYValue = (RateYValue)ysettings.getValueType(); Preconditions.checkNotNull(rateYValue); Series<Object, Integer> baseSeries = rateBaseSeriesGenerator.generateRateBaseSeries(criteria, xsettings); return recalculateSeries(series, baseSeries, rateYValue.getRateRatio()); }  @Override Series<Object, ? extends Number> recalculateSeries(Series<Object, Integer> series, JudgmentSeriesCriteria criteria, XSettings xsettings, YSettings ysettings); @Override boolean handles(YValueType yValueType); @Autowired void setRateBaseSeriesGenerator(RateBaseSeriesGenerator rateBaseSeriesGenerator);  }### Answer:
@Test(expected = NullPointerException.class) public void recalculateSeries_NullRateYValue() { Series<Object, Integer> series = new Series<>(); recalculator.recalculateSeries(series, new JudgmentSeriesCriteria(), new XSettings(), new YSettings()); }
@Test public void recalculateSeries() { Series<Object, Integer> series = new Series<>(); series.addPoint("A", 123); series.addPoint("B", 30); Series<Object, Integer> baseSeries = new Series<>(); baseSeries.addPoint("A", 12343); baseSeries.addPoint("B", 267); JudgmentSeriesCriteria seriesCriteria = mock(JudgmentSeriesCriteria.class); XSettings xsettings = mock(XSettings.class); YSettings ysettings = new YSettings(); ysettings.setValueType(new RateYValue(1000)); when(rateBaseSeriesGenerator.generateRateBaseSeries(seriesCriteria, xsettings)).thenReturn(baseSeries); Series<Object, ? extends Number> recalcSeries = recalculator.recalculateSeries(series, seriesCriteria, xsettings, ysettings); assertRecalcPoint(recalcSeries.getPoints().get(0), "A", 9.965f); assertRecalcPoint(recalcSeries.getPoints().get(1), "B", 112.36f); }