Env { public static int getInt(String name, int defaultValue) { return Stream.of(name) .map(Env::normalizeKey) .map(envMap::get) .filter(Objects::nonNull) .findFirst() .map(Integer::parseInt) .orElse(defaultValue); }  static String get(String name); static String getString(String name, String defaultValue); static int getInt(String name, int defaultValue); static long getLong(String name, long defaultValue);  }
@Test public void fromProperty() { assertThat(Env.getInt("TEST_PROP", 3)).isEqualTo(1234); assertThat(Env.getInt("test.prop", 3)).isEqualTo(1234); assertThat(Env.getInt("test-prop", 3)).isEqualTo(3); }