Search in sources :

Example 1 with Section

use of org.ini4j.Profile.Section in project buck by facebook.

the class IniTest method testSecondaryLoadOverridesOriginalDefs.

@Test
public void testSecondaryLoadOverridesOriginalDefs() throws IOException {
    Ini ini = new Ini();
    Reader originalInput = new StringReader(Joiner.on("\n").join("[alias]", "  buck = //src/com/facebook/buck/cli:cli", "[cache]", "  mode = dir"));
    Reader overrideInput = new StringReader(Joiner.on("\n").join("[alias]", "  test_util = //test/com/facebook/buck/util:util", "[cache]", "  mode ="));
    ini.load(originalInput);
    ini.load(overrideInput);
    Section aliasSection = ini.get("alias");
    assertEquals("Should be the union of the two [alias] sections.", ImmutableMap.of("buck", "//src/com/facebook/buck/cli:cli", "test_util", "//test/com/facebook/buck/util:util"), aliasSection);
    Section cacheSection = ini.get("cache");
    assertEquals("Values from overrideInput should supercede those from originalInput, as appropriate.", ImmutableMap.of("mode", ""), cacheSection);
}
Also used : Ini(org.ini4j.Ini) StringReader(java.io.StringReader) StringReader(java.io.StringReader) Reader(java.io.Reader) Section(org.ini4j.Profile.Section) Test(org.junit.Test)

Aggregations

Reader (java.io.Reader)1 StringReader (java.io.StringReader)1 Ini (org.ini4j.Ini)1 Section (org.ini4j.Profile.Section)1 Test (org.junit.Test)1