@VisibleForTesting
  static Function<List<String>, ProcessBuilder> defaultProcessBuilderFactory(
      String dockerExecutable, ImmutableMap<String, String> dockerEnvironment) {
    return dockerSubCommand -> {
      List<String> dockerCommand = new ArrayList<>(1 + dockerSubCommand.size());
      dockerCommand.add(dockerExecutable);
      dockerCommand.addAll(dockerSubCommand);

      ProcessBuilder processBuilder = new ProcessBuilder(dockerCommand);
      Map<String, String> environment = processBuilder.environment();
      environment.putAll(dockerEnvironment);

      return processBuilder;
    };
  }
@Test
  public void testDefaultProcessorBuilderFactory_customEnvironment() {
    ImmutableMap<String, String> environment = ImmutableMap.of("Key1", "Value1");

    Map<String, String> expectedEnvironment = new HashMap<>(System.getenv());
    expectedEnvironment.putAll(environment);

    ProcessBuilder processBuilder =
        CliDockerClient.defaultProcessBuilderFactory("docker", environment)
            .apply(Collections.emptyList());

    Assert.assertEquals(expectedEnvironment, processBuilder.environment());
  }