### Question:
FacetValueConverterManager { public FacetValueConverter getConverter(XSettings xsettings) { Preconditions.checkNotNull(xsettings); for (FacetValueConverter converter :converters) { if (converter.handles(xsettings)) { return converter; } } throw new IllegalArgumentException("no FacetValueConverter can be found for " + xsettings); }  FacetValueConverter getConverter(XSettings xsettings); void setConverters(List<? extends FacetValueConverter> converters);  }### Answer:
@Test(expected = NullPointerException.class) public void getConverter_NULL_X_SETTINGS() { manager.getConverter(null); }
@Test(expected = IllegalArgumentException.class) public void getConverter_NO_HANDLING_CONVERTER_FOUND() { XSettings xsettings1 = mock(XSettings.class); when(facetValueConverter1.handles(xsettings1)).thenReturn(false); when(facetValueConverter2.handles(xsettings1)).thenReturn(false); manager.getConverter(xsettings1); }
@Test public void getConverter() { XSettings xsettings1 = mock(XSettings.class); XSettings xsettings2 = mock(XSettings.class); when(facetValueConverter1.handles(xsettings1)).thenReturn(true); when(facetValueConverter1.handles(xsettings2)).thenReturn(false); when(facetValueConverter2.handles(xsettings1)).thenReturn(false); when(facetValueConverter2.handles(xsettings2)).thenReturn(true); assertTrue(facetValueConverter1 == manager.getConverter(xsettings1)); assertFalse(facetValueConverter1 == manager.getConverter(xsettings2)); assertTrue(facetValueConverter2 == manager.getConverter(xsettings2)); assertFalse(facetValueConverter2 == manager.getConverter(xsettings1)); }