ComponentConfigIniLoader extends AbstractComponentConfigLoader { public void load(final Resource resource, final int depth, final ComponentConfig config) { ArgumentChecker.notNull(resource, "resource"); ArgumentChecker.notNull(config, "config"); try { doLoad(resource, depth, config); overrideProperties(config); } catch (RuntimeException ex) { throw new ComponentConfigException("Unable to load INI file: " + resource, ex); } } ComponentConfigIniLoader(ComponentLogger logger, ConfigProperties properties); void load(final Resource resource, final int depth, final ComponentConfig config);  }
@Test(expectedExceptions = ComponentConfigException.class) public void test_loadInvalid_doubleKey() { ConfigProperties properties = new ConfigProperties(); ComponentConfigIniLoader loader = new ComponentConfigIniLoader(LOGGER, properties ); String str = "[block]" + NEWLINE + "m = p" + NEWLINE + "m = s" + NEWLINE; Resource resource = new ByteArrayResource(str.getBytes()); loader.load(resource, 0, new ComponentConfig()); }
@Test(expectedExceptions = ComponentConfigException.class) public void test_loadInvalid_replacementNotFound() { ConfigProperties properties = new ConfigProperties(); ComponentConfigIniLoader loader = new ComponentConfigIniLoader(LOGGER, properties ); String str = "[block]" + NEWLINE + "m = ${notFound}" + NEWLINE; Resource resource = new ByteArrayResource(str.getBytes()); loader.load(resource, 0, new ComponentConfig()); }
@Test(expectedExceptions = ComponentConfigException.class) public void test_loadInvalid_propertyNotInGroup() { ConfigProperties properties = new ConfigProperties(); ComponentConfigIniLoader loader = new ComponentConfigIniLoader(LOGGER, properties ); String str = "m = foo" + NEWLINE; Resource resource = new ByteArrayResource(str.getBytes()); loader.load(resource, 0, new ComponentConfig()); }
@Test(expectedExceptions = ComponentConfigException.class) public void test_loadInvalid_propertyNoEquals() { ConfigProperties properties = new ConfigProperties(); ComponentConfigIniLoader loader = new ComponentConfigIniLoader(LOGGER, properties ); String str = "[block]" + NEWLINE + "m" + NEWLINE; Resource resource = new ByteArrayResource(str.getBytes()); loader.load(resource, 0, new ComponentConfig()); }
@Test(expectedExceptions = ComponentConfigException.class) public void test_loadInvalid_propertyEmptyKey() { ConfigProperties properties = new ConfigProperties(); ComponentConfigIniLoader loader = new ComponentConfigIniLoader(LOGGER, properties ); String str = "[block]" + NEWLINE + "= foo" + NEWLINE; Resource resource = new ByteArrayResource(str.getBytes()); loader.load(resource, 0, new ComponentConfig()); }