@Test public void convert() { Chart<Object, Number> chart = createChart(); ApiSeries apiSeries1 = mock(ApiSeries.class); ApiSeries apiSeries2 = mock(ApiSeries.class); when(seriesConverter.convert(chart.getSeriesList().get(0))).thenReturn(apiSeries1); when(seriesConverter.convert(chart.getSeriesList().get(1))).thenReturn(apiSeries2); ApiChart apiChart = chartConverter.convert(chart); assertNotNull(apiChart); assertEquals(2, apiChart.getSeriesList().size()); assertTrue(apiSeries1 == apiChart.getSeriesList().get(0)); assertTrue(apiSeries2 == apiChart.getSeriesList().get(1)); }
public ApiChart convert(Chart<?, Number> chart) { Preconditions.checkNotNull(chart); ApiChart uiChart = new ApiChart(); for (Series<?, ?> series : chart.getSeriesList()) { uiChart.addSeries(seriesConverter.convert(series)); } return uiChart; }
ChartConverter { public ApiChart convert(Chart<?, Number> chart) { Preconditions.checkNotNull(chart); ApiChart uiChart = new ApiChart(); for (Series<?, ?> series : chart.getSeriesList()) { uiChart.addSeries(seriesConverter.convert(series)); } return uiChart; } }
ChartConverter { public ApiChart convert(Chart<?, Number> chart) { Preconditions.checkNotNull(chart); ApiChart uiChart = new ApiChart(); for (Series<?, ?> series : chart.getSeriesList()) { uiChart.addSeries(seriesConverter.convert(series)); } return uiChart; }  }
ChartConverter { public ApiChart convert(Chart<?, Number> chart) { Preconditions.checkNotNull(chart); ApiChart uiChart = new ApiChart(); for (Series<?, ?> series : chart.getSeriesList()) { uiChart.addSeries(seriesConverter.convert(series)); } return uiChart; }  ApiChart convert(Chart<?, Number> chart); void setSeriesConverter(SeriesConverter seriesConverter); }
ChartConverter { public ApiChart convert(Chart<?, Number> chart) { Preconditions.checkNotNull(chart); ApiChart uiChart = new ApiChart(); for (Series<?, ?> series : chart.getSeriesList()) { uiChart.addSeries(seriesConverter.convert(series)); } return uiChart; }  ApiChart convert(Chart<?, Number> chart); void setSeriesConverter(SeriesConverter seriesConverter);  }