List of usage examples for org.apache.commons.configuration INIConfiguration getSections
public Set getSections()
From source file:io.datalayer.conf.IniConfigurationTest.java
/** * Test of getSections method, of class {@link INIConfiguration}. *///from w ww. j a v a 2 s .com @Test public void testGetSections() { INIConfiguration instance = new INIConfiguration(); instance.addProperty("test1.foo", "bar"); instance.addProperty("test2.foo", "abc"); Set<String> expResult = new HashSet<String>(); expResult.add("test1"); expResult.add("test2"); Set<String> result = instance.getSections(); assertEquals(expResult, result); }
From source file:io.datalayer.conf.IniConfigurationTest.java
/** * Helper method for testing the load operation. Loads the specified content * into a configuration and then checks some properties. * * @param data the data to load/*from w w w . j av a 2s .co m*/ */ private void checkLoad(String data) throws ConfigurationException, IOException { Reader reader = new StringReader(data); INIConfiguration instance = new INIConfiguration(); instance.load(reader); reader.close(); assertTrue(instance.getString("section1.var1").equals("foo")); assertTrue(instance.getInt("section1.var2") == 451); assertTrue(instance.getDouble("section2.var1") == 123.45); assertTrue(instance.getString("section2.var2").equals("bar")); assertTrue(instance.getBoolean("section3.var1")); assertTrue(instance.getSections().size() == 3); }