### Question:
XRangeConverterManager { public XRangeConverter getXRangeConverter(Class<? extends XRange> clazz) { Preconditions.checkNotNull(clazz); for (XRangeConverter xRangeConverter : xRangeConverters) { if (xRangeConverter.isApplicable(clazz)) { return xRangeConverter; } } throw new IllegalArgumentException("No XRangeConverter applicable for " + clazz + " found."); }  XRangeConverter getXRangeConverter(Class<? extends XRange> clazz); @Autowired void setxRangeConverters(List<XRangeConverter> xRangeConverters);  }### Answer:
@Test public void getXRangeConverter_FOUND() { when(xRangeConverter1.isApplicable(XDateRange.class)).thenReturn(false); when(xRangeConverter2.isApplicable(XDateRange.class)).thenReturn(true); XRangeConverter retXRangeConverter = xRangeConverterManager.getXRangeConverter(XDateRange.class); assertTrue(retXRangeConverter == xRangeConverter2); }
@Test(expected = IllegalArgumentException.class) public void getXRangeConverter_NOT_FOUND() { when(xRangeConverter1.isApplicable(any())).thenReturn(false); when(xRangeConverter2.isApplicable(any())).thenReturn(false); xRangeConverterManager.getXRangeConverter(XDateRange.class); }
@Test(expected = NullPointerException.class) public void getXRangeConverter_NULL_CLASS_ARGUMENT() { xRangeConverterManager.getXRangeConverter(null); }