### Question:
EnvironmentVariables { public static Map<String, String> expand() { return expand(System.getenv()); } private  EnvironmentVariables(); static boolean shouldAlias(final String name); static Map<String, String> expand(); static Map<String, String> expand(final Map<String, String> env);  }### Answer:
@Test public void testNotAliased() { Map<String, String> env = toMap("", "v", "_", "v", "__", "v", "x__y", "v", "_xy", "v", "xy_", "v", "xyz", "v"); Map<String, String> mapped = EnvironmentVariables.expand(env); assertThat(mapped, is(not(nullValue()))); assertThat(mapped.size(), is(7)); assertThat(mapped, hasEntry("", "v")); assertThat(mapped, hasEntry("_", "v")); assertThat(mapped, hasEntry("__", "v")); assertThat(mapped, hasEntry("x__y", "v")); assertThat(mapped, hasEntry("_xy", "v")); assertThat(mapped, hasEntry("xy_", "v")); assertThat(mapped, hasEntry("xyz", "v")); }
@Test public void testDashAliases() { Map<String, String> env = toMap("SERVER_EXECUTOR_dash_SERVICE_MAX_dash_POOL_dash_SIZE", "16", "APP_PAGE_DASH_SIZE", "17"); Map<String, String> expanded = EnvironmentVariables.expand(env); assertThat(expanded, is(not(nullValue()))); assertThat(expanded.size(), is(6)); assertThat(expanded, hasEntry("SERVER_EXECUTOR_dash_SERVICE_MAX_dash_POOL_dash_SIZE", "16")); assertThat(expanded, hasEntry("SERVER.EXECUTOR-SERVICE.MAX-POOL-SIZE", "16")); assertThat(expanded, hasEntry("server.executor-service.max-pool-size", "16")); assertThat(expanded, hasEntry("APP_PAGE_DASH_SIZE", "17")); assertThat(expanded, hasEntry("APP.PAGE-SIZE", "17")); assertThat(expanded, hasEntry("app.page-size", "17")); }
@Test public void testCamelCaseAliases() { Map<String, String> env = toMap("app_someKey", "v"); Map<String, String> expanded = EnvironmentVariables.expand(env); assertThat(expanded, is(not(nullValue()))); assertThat(expanded.size(), is(3)); assertThat(expanded, hasEntry("app_someKey", "v")); assertThat(expanded, hasEntry("app.someKey", "v")); assertThat(expanded, hasEntry("app.somekey", "v")); }