EnvUtil { public static int getInt(String envName, int defaultValue) { int value = defaultValue; String envValue = System.getenv(envName); if (envValue != null) { try { value = Integer.parseInt(envValue); } catch (NumberFormatException e) { } } return value; }  static int getInt(String envName, int defaultValue); static long getLong(String envName, long defaultValue);  }
@Test public void getInt() { assertEquals(123, EnvUtil.getInt("myInt", 234)); assertEquals(234, EnvUtil.getLong("wrongInt", 234)); }