@Test public void override_env_variables() { System2 system = mock(System2.class); when(system.envVariables()).thenReturn(ImmutableMap.of("JAVA_HOME", "/default/path/to/java")); Command command = new Command("java", system); command.setEnvironmentVariable("JAVA_HOME", "/new/path/to/java"); assertThat(command.getEnvironmentVariables().get("JAVA_HOME")).isEqualTo("/new/path/to/java"); }
builder.directory(command.getDirectory()); builder.environment().putAll(command.getEnvironmentVariables()); process = builder.start();
@Test public void initialize_with_current_env() { Command command = Command.create("java"); assertThat(command.getEnvironmentVariables()).isNotEmpty(); }
builder.directory(command.getDirectory()); builder.environment().putAll(command.getEnvironmentVariables()); process = builder.start();
builder.directory(command.getDirectory()); builder.environment().putAll(command.getEnvironmentVariables()); process = builder.start();