@Test public void getXSettingsGenerator() { XSettingsGenerator xsettingsGenerator1 = mock(XSettingsGenerator.class); when(xsettingsGenerator1.handles(Mockito.any(ChartCode.class))).thenReturn(false); XSettingsGenerator xsettingsGenerator2 = mock(XSettingsGenerator.class); when(xsettingsGenerator2.handles(ChartCode.MAIN_CHART)).thenReturn(true); xsettingsGeneratorManager.setXsettingsGenerators(Lists.newArrayList(xsettingsGenerator1, xsettingsGenerator2)); assertTrue(xsettingsGenerator2 == xsettingsGeneratorManager.getXSettingsGenerator(ChartCode.MAIN_CHART)); }
public XSettingsGenerator getXSettingsGenerator(ChartCode chartCode) { Preconditions.checkNotNull(chartCode); for (XSettingsGenerator xsettingsGenerator : xsettingsGenerators) { if (xsettingsGenerator.handles(chartCode)) { return xsettingsGenerator; } } throw new IllegalArgumentException("no " + XSettingsGenerator.class.getName() + " handling " + chartCode.name() + " found"); }
XSettingsGeneratorManager { public XSettingsGenerator getXSettingsGenerator(ChartCode chartCode) { Preconditions.checkNotNull(chartCode); for (XSettingsGenerator xsettingsGenerator : xsettingsGenerators) { if (xsettingsGenerator.handles(chartCode)) { return xsettingsGenerator; } } throw new IllegalArgumentException("no " + XSettingsGenerator.class.getName() + " handling " + chartCode.name() + " found"); } }
XSettingsGeneratorManager { public XSettingsGenerator getXSettingsGenerator(ChartCode chartCode) { Preconditions.checkNotNull(chartCode); for (XSettingsGenerator xsettingsGenerator : xsettingsGenerators) { if (xsettingsGenerator.handles(chartCode)) { return xsettingsGenerator; } } throw new IllegalArgumentException("no " + XSettingsGenerator.class.getName() + " handling " + chartCode.name() + " found"); }  }
XSettingsGeneratorManager { public XSettingsGenerator getXSettingsGenerator(ChartCode chartCode) { Preconditions.checkNotNull(chartCode); for (XSettingsGenerator xsettingsGenerator : xsettingsGenerators) { if (xsettingsGenerator.handles(chartCode)) { return xsettingsGenerator; } } throw new IllegalArgumentException("no " + XSettingsGenerator.class.getName() + " handling " + chartCode.name() + " found"); }  XSettingsGenerator getXSettingsGenerator(ChartCode chartCode); @Autowired void setXsettingsGenerators(List<XSettingsGenerator> xsettingsGenerators); }
XSettingsGeneratorManager { public XSettingsGenerator getXSettingsGenerator(ChartCode chartCode) { Preconditions.checkNotNull(chartCode); for (XSettingsGenerator xsettingsGenerator : xsettingsGenerators) { if (xsettingsGenerator.handles(chartCode)) { return xsettingsGenerator; } } throw new IllegalArgumentException("no " + XSettingsGenerator.class.getName() + " handling " + chartCode.name() + " found"); }  XSettingsGenerator getXSettingsGenerator(ChartCode chartCode); @Autowired void setXsettingsGenerators(List<XSettingsGenerator> xsettingsGenerators);  }