@Test public void convert() { Series<String, Integer> series = new Series<>(); Point<String, Integer> point1 = new Point<>("A", 1); Point<String, Integer> point2 = new Point<>("B", 2); series.addPoint(point1); series.addPoint(point2); String[] apiPoint1 = new String[]{"X", "1243"}; String[] apiPoint2 = new String[]{"Y", "223"}; when(pointFormatter.formatPoint(point1)).thenReturn(apiPoint1); when(pointFormatter.formatPoint(point2)).thenReturn(apiPoint2); ApiSeries apiSeries = seriesConverter.convert(series); assertNotNull(apiSeries); assertEquals(2, apiSeries.getPoints().size()); assertArrayEquals(apiPoint1, apiSeries.getPoints().get(0)); assertArrayEquals(apiPoint2, apiSeries.getPoints().get(1)); }
public ApiSeries convert(Series<?, ?> series) { Preconditions.checkNotNull(series); ApiSeries apiSeries = new ApiSeries(); for (Point<?,?> point : series.getPoints()) { apiSeries.addPoint(pointFormatter.formatPoint(point)); } return apiSeries; }
SeriesConverter { public ApiSeries convert(Series<?, ?> series) { Preconditions.checkNotNull(series); ApiSeries apiSeries = new ApiSeries(); for (Point<?,?> point : series.getPoints()) { apiSeries.addPoint(pointFormatter.formatPoint(point)); } return apiSeries; } }
SeriesConverter { public ApiSeries convert(Series<?, ?> series) { Preconditions.checkNotNull(series); ApiSeries apiSeries = new ApiSeries(); for (Point<?,?> point : series.getPoints()) { apiSeries.addPoint(pointFormatter.formatPoint(point)); } return apiSeries; }  }
SeriesConverter { public ApiSeries convert(Series<?, ?> series) { Preconditions.checkNotNull(series); ApiSeries apiSeries = new ApiSeries(); for (Point<?,?> point : series.getPoints()) { apiSeries.addPoint(pointFormatter.formatPoint(point)); } return apiSeries; }  ApiSeries convert(Series<?, ?> series); void setPointFormatter(PointFormatter pointFormatter); }
SeriesConverter { public ApiSeries convert(Series<?, ?> series) { Preconditions.checkNotNull(series); ApiSeries apiSeries = new ApiSeries(); for (Point<?,?> point : series.getPoints()) { apiSeries.addPoint(pointFormatter.formatPoint(point)); } return apiSeries; }  ApiSeries convert(Series<?, ?> series); void setPointFormatter(PointFormatter pointFormatter);  }