Config { private Config() { throw new IllegalStateException("Config"); } private  Config(); static String getSysConf(String key, String def, JsonObject conf); static Boolean getSysConfBoolean(String key, Boolean def, JsonObject conf);  }
@Test public void testConfig() { JsonObject conf = new JsonObject(); final String varName = "foo-bar92304239"; Assert.assertEquals("123", Config.getSysConf(varName, "123", conf)); Assert.assertEquals(null, Config.getSysConf(varName, null, conf)); conf.put(varName, "124"); Assert.assertEquals("124", Config.getSysConf(varName, "123", conf)); System.setProperty(varName, "129"); Assert.assertEquals("129", Config.getSysConf(varName, "123", conf)); System.setProperty(varName, ""); Assert.assertEquals("124", Config.getSysConf(varName, "123", conf)); }