@Test public void loadBooleanValues2() { Assert.assertThat(cfg2, is(notNullValue())); final Configuration config = cfg2.getConfiguration(); Assert.assertThat(config, is(notNullValue())); final Boolean s_cfg1 = config.getBoolean("boolean-null-value", null); Assert.assertThat(s_cfg1, is(nullValue())); final boolean s_cfg2 = config.getBoolean("boolean-value"); Assert.assertThat(s_cfg2, is(true)); }
@Test public void loadStringValues() { Assert.assertThat(cfg, is(notNullValue())); final Configuration config = cfg.getConfiguration(); Assert.assertThat(config, is(notNullValue())); final String s_cfg1 = config.getString("string-null-value"); Assert.assertThat(s_cfg1, is(nullValue())); final String s_cfg2 = config.getString("string-value"); Assert.assertThat(s_cfg2, is("the-test-value")); }
@Test public void loadUriValues() { Assert.assertThat(cfg, is(notNullValue())); final Configuration config = cfg.getConfiguration(); Assert.assertThat(config, is(notNullValue())); final String s_cfg1 = config.getString("uri-null-value"); Assert.assertThat(s_cfg1, is(nullValue())); final String s_cfg2 = config.getString("uri-value"); Assert.assertThat(s_cfg2, is("http://www.likeness.com/")); }
@Test public void loadUriValues2() { Assert.assertThat(cfg2, is(notNullValue())); final Configuration config = cfg2.getConfiguration(); Assert.assertThat(config, is(notNullValue())); final String s_cfg1 = config.getString("uri-null-value"); Assert.assertThat(s_cfg1, is(nullValue())); final String s_cfg2 = config.getString("uri-value"); Assert.assertThat(s_cfg2, is("http://www.likeness.com/")); }
@Test public void loadStringValues2() { Assert.assertThat(cfg2, is(notNullValue())); final Configuration config = cfg2.getConfiguration(); Assert.assertThat(config, is(notNullValue())); final String s_cfg1 = config.getString("string-null-value"); Assert.assertThat(s_cfg1, is(nullValue())); final String s_cfg2 = config.getString("string-value"); Assert.assertThat(s_cfg2, is("the-test-value")); }
@Test public void loadBooleanValues2() { Assert.assertThat(cfg2, is(notNullValue())); final Configuration config = cfg2.getConfiguration(); Assert.assertThat(config, is(notNullValue())); final Boolean s_cfg1 = config.getBoolean("boolean-null-value", null); Assert.assertThat(s_cfg1, is(nullValue())); final boolean s_cfg2 = config.getBoolean("boolean-value"); Assert.assertThat(s_cfg2, is(true)); }
@Test public void testSubConfig() { Assert.assertThat(cfg, is(notNullValue())); final Configuration config = cfg.getConfiguration("prefix.of.three"); Assert.assertThat(config, is(notNullValue())); final String s_cfg1 = config.getString("string-null-value"); Assert.assertThat(s_cfg1, is(nullValue())); final String s_cfg2 = config.getString("string-value"); Assert.assertThat(s_cfg2, is("the-test-value")); }
@Test public void loadStringValues2() { Assert.assertThat(cfg2, is(notNullValue())); final Configuration config = cfg2.getConfiguration(); Assert.assertThat(config, is(notNullValue())); Assert.assertThat(System.getProperty("string-value"), is("OVERRIDDEN")); final String s_cfg2 = config.getString("string-value"); Assert.assertThat(s_cfg2, is("OVERRIDDEN")); } }
@Test public void loadStringValues() { Assert.assertThat(cfg, is(notNullValue())); final Configuration config = cfg.getConfiguration(); Assert.assertThat(config, is(notNullValue())); final String s_cfg1 = config.getString("string-null-value"); Assert.assertThat(s_cfg1, is(nullValue())); final String s_cfg2 = config.getString("string-value"); Assert.assertThat(s_cfg2, is("the-test-value")); }
@Test public void loadBooleanValues() { Assert.assertThat(cfg, is(notNullValue())); final Configuration config = cfg.getConfiguration(); Assert.assertThat(config, is(notNullValue())); final Boolean s_cfg1 = config.getBoolean("boolean-null-value", null); Assert.assertThat(s_cfg1, is(nullValue())); final boolean s_cfg2 = config.getBoolean("boolean-value"); Assert.assertThat(s_cfg2, is(true)); }
@Test public void loadUriValues2() { Assert.assertThat(cfg2, is(notNullValue())); final Configuration config = cfg2.getConfiguration(); Assert.assertThat(config, is(notNullValue())); final String s_cfg1 = config.getString("uri-null-value"); Assert.assertThat(s_cfg1, is(nullValue())); final String s_cfg2 = config.getString("uri-value"); Assert.assertThat(s_cfg2, is("http://www.likeness.com/")); }
@Test public void loadStringValues() { Assert.assertThat(cfg, is(notNullValue())); final Configuration config = cfg.getConfiguration(); Assert.assertThat(config, is(notNullValue())); Assert.assertThat(System.getProperty("string-value"), is("OVERRIDDEN")); Assert.assertThat(System.getProperties().getProperty("string-value"), is("OVERRIDDEN")); final String s_cfg2 = config.getString("string-value"); Assert.assertThat(s_cfg2, is("OVERRIDDEN")); }
@Test public void loadIntValues2() { Assert.assertThat(cfg2, is(notNullValue())); final Configuration config = cfg2.getConfiguration(); Assert.assertThat(config, is(notNullValue())); final Integer s_cfg1 = config.getInteger("int-null-value", null); Assert.assertThat(s_cfg1, is(nullValue())); final int s_cfg2 = config.getInt("int-value"); Assert.assertThat(s_cfg2, is(12345)); }
@Test public void loadIntValues2() { Assert.assertThat(cfg2, is(notNullValue())); final Configuration config = cfg2.getConfiguration(); Assert.assertThat(config, is(notNullValue())); final Integer s_cfg1 = config.getInteger("int-null-value", null); Assert.assertThat(s_cfg1, is(nullValue())); final int s_cfg2 = config.getInt("int-value"); Assert.assertThat(s_cfg2, is(12345)); }
@Test public void loadIntValues() { Assert.assertThat(cfg, is(notNullValue())); final Configuration config = cfg.getConfiguration(); Assert.assertThat(config, is(notNullValue())); final Integer s_cfg1 = config.getInteger("int-null-value", null); Assert.assertThat(s_cfg1, is(nullValue())); final int s_cfg2 = config.getInt("int-value"); Assert.assertThat(s_cfg2, is(12345)); }
@Test public void testSuperConfig() { Config ts = Config.getConfig("classpath:/test-config/legacy", "test:test_super"); Configuration c = ts.getConfiguration(); Assert.assertEquals("yay", c.getString("hi")); Assert.assertEquals("frob", c.getString("yay")); }
@Test public void testDefaultConfig() { Config d = Config.getConfig("classpath:/test-config/hierarchy", "default"); Assert.assertFalse(d.getConfiguration().getBoolean("production")); Assert.assertTrue(d.getConfiguration().getBoolean("unitTesting", false)); }
@Test public void testConfig() { Config p = Config.getConfig("classpath:/test-config/hierarchy", "production"); Config t = Config.getConfig("classpath:/test-config/hierarchy", "test"); Assert.assertTrue(p.getConfiguration().getBoolean("production")); Assert.assertFalse(t.getConfiguration().getBoolean("production")); }
@Test public void testConfig() { Config p = Config.getConfig("classpath:/test-config/legacy", "production"); Config t = Config.getConfig("classpath:/test-config/legacy", "test"); Assert.assertTrue(p.getConfiguration().getBoolean("production")); Assert.assertFalse(t.getConfiguration().getBoolean("production")); }
@Test public void testEmpty() { final Config emptyConfig = Config.getEmptyConfig(); Assert.assertNotNull(emptyConfig); Assert.assertFalse(emptyConfig.getConfiguration().getKeys().hasNext()); } }