PropertyUtil { public static String getProperty(String key, String defaultValue) { return System.getProperties().getProperty(key, System.getenv().getOrDefault(key, defaultValue)); }  static boolean isPropertySet(String key); static int getIntProperty(String key, int defaultValue); static boolean getBooleanProperty(String key, boolean defaultValue); static String getProperty(String key, String defaultValue);  }
@Test public void testStringProperty() { String key = "test1"; String default_val = "test1-notset"; Assert.assertEquals("test1-prop", PropertyUtil.getProperty(key, default_val)); key = "test2"; default_val = "test2-notset"; Assert.assertEquals("test2-env", PropertyUtil.getProperty(key, default_val)); key = "test3"; default_val = "test3-notset"; Assert.assertEquals("test3-prop", PropertyUtil.getProperty(key, default_val)); }