### Question:
DockerClient { @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; }; } DockerClient(Path dockerExecutable, Map<String, String> dockerEnvironment); @VisibleForTesting  DockerClient(Function<List<String>, ProcessBuilder> processBuilderFactory); static boolean isDefaultDockerInstalled(); static boolean isDockerInstalled(Path dockerExecutable); String load(ImageTarball imageTarball, Consumer<Long> writtenByteCountListener); void save(
      ImageReference imageReference, Path outputPath, Consumer<Long> writtenByteCountListener); DockerImageDetails inspect(ImageReference imageReference); static final Path DEFAULT_DOCKER_CLIENT; }### Answer:
@Test public void testDefaultProcessorBuilderFactory_customExecutable() { ProcessBuilder processBuilder = DockerClient.defaultProcessBuilderFactory("docker-executable", ImmutableMap.of()) .apply(Arrays.asList("sub", "command")); Assert.assertEquals( Arrays.asList("docker-executable", "sub", "command"), processBuilder.command()); Assert.assertEquals(System.getenv(), processBuilder.environment()); }
@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 = DockerClient.defaultProcessBuilderFactory("docker", environment) .apply(Collections.emptyList()); Assert.assertEquals(expectedEnvironment, processBuilder.environment()); }