### Question:
FacetToSeriesConverter { public Series<Object, Integer> convert(List<FacetCount> facetCounts, XSettings xsettings) { Preconditions.checkNotNull(facetCounts); Preconditions.checkNotNull(xsettings); FacetValueConverter xValueConverter = facetValueConverterManager.getConverter(xsettings); Series<Object, Integer> series = new Series<Object, Integer>(); for (FacetCount count : facetCounts) { series.addPoint(xValueConverter.convert(count.getValue(), xsettings), count.getCount()); } return series; }  Series<Object, Integer> convert(List<FacetCount> facetCounts, XSettings xsettings); @Autowired void setFacetValueConverterManager(FacetValueConverterManager facetValueConverterManager);  }### Answer:
@Test public void convert() { List<FacetCount> facetCounts = Lists.newArrayList(); facetCounts.add(new FacetCount("AAA", 4)); facetCounts.add(new FacetCount("EFGH", 1)); XSettings xsettings = mock(XSettings.class); FacetValueConverter facetValueConverter = mock(FacetValueConverter.class); when(facetValueConverterManager.getConverter(xsettings)).thenReturn(facetValueConverter); when(facetValueConverter.convert("AAA", xsettings)).thenReturn("AAA_converted"); when(facetValueConverter.convert("EFGH", xsettings)).thenReturn("EFGH_converted"); Series<Object, Integer> series = facetToSeriesConverter.convert(facetCounts, xsettings); List<Point<Object, Integer>> expectedPoints = Lists.newArrayList(); expectedPoints.add(new Point<>("AAA_converted", 4)); expectedPoints.add(new Point<>("EFGH_converted", 1)); assertEquals(expectedPoints, series.getPoints()); }
@Test(expected = NullPointerException.class) public void convert_NULL_FACET_COUNTS() { facetToSeriesConverter.convert(null, xsettings); }
@Test(expected = NullPointerException.class) public void convert_NULL_XSETTINGS() { List<FacetCount> facetCounts = Lists.newArrayList(); facetToSeriesConverter.convert(facetCounts, null); }