CustomizableModules { public Set<Module> load(Configuration config) { Configuration moduleConfig = config.subset(MODULE_CONFIG_PREFIX); return customizedConfiguration(moduleConfig); }  Set<Module> load(Configuration config); @SuppressWarnings("unchecked") Set<Module> customizedConfiguration(Configuration moduleConfig); static final String MODULE_CONFIG_PREFIX; }
@Test public void shouldLoadAndParseConfigurationFile() throws Exception { Configuration config = new PropertiesFileConfiguration( getAbsolutePath("customizable_modules_test.conf")); Set<Module> loaded = new CustomizableModules().load(config); assertEquals(1, loaded.size()); assertTrue(loaded.iterator().next() instanceof DummyModuleForTesting); }
@Test(expected = RuntimeException.class) public void shouldFailWhenConfigurationContainsMissingClass() throws Exception { Configuration config = new PropertiesFileConfiguration( getAbsolutePath("customizable_modules_with_missing_class.conf")); new CustomizableModules().load(config); }