DefaultStrategiesHelper { public <T> List<T> getDefaultStrategies(Class<T> strategyInterface) throws BeanInitializationException { return getDefaultStrategies(strategyInterface, null); } DefaultStrategiesHelper(Properties defaultStrategies);  DefaultStrategiesHelper(Resource resource);  DefaultStrategiesHelper(Class<?> type); List<T> getDefaultStrategies(Class<T> strategyInterface); @SuppressWarnings("unchecked") List<T> getDefaultStrategies(Class<T> strategyInterface, ApplicationContext applicationContext); T getDefaultStrategy(Class<T> strategyInterface); T getDefaultStrategy(Class<T> strategyInterface, ApplicationContext applicationContext);  }
@Test public void testGetDefaultStrategies() throws Exception { Properties strategies = new Properties(); strategies.put(Strategy.class.getName(), StrategyImpl.class.getName() + "," + ContextAwareStrategyImpl.class.getName()); DefaultStrategiesHelper helper = new DefaultStrategiesHelper(strategies); StaticApplicationContext applicationContext = new StaticApplicationContext(); applicationContext.registerSingleton("strategy1", StrategyImpl.class); applicationContext.registerSingleton("strategy2", ContextAwareStrategyImpl.class); List<Strategy> result = helper.getDefaultStrategies(Strategy.class, applicationContext); Assert.assertNotNull("No result", result); Assert.assertEquals("Invalid amount of strategies", 2, result.size()); Assert.assertTrue("Result not a Strategy implementation", result.get(0) != null); Assert.assertTrue("Result not a Strategy implementation", result.get(1) != null); Assert.assertTrue("Result not a StrategyImpl implementation", result.get(0) instanceof StrategyImpl); Assert.assertTrue("Result not a StrategyImpl implementation", result.get(1) instanceof ContextAwareStrategyImpl); ContextAwareStrategyImpl impl = (ContextAwareStrategyImpl) result.get(1); Assert.assertNotNull("No application context injected", impl.getApplicationContext()); }