public static DockerHealthCheck.Builder fromCommand(List<String> command) {
    Preconditions.checkArgument(!command.isEmpty(), "command must not be empty");
    Preconditions.checkArgument(
        command.stream().allMatch(Objects::nonNull), "command must not contain null elements");
    return new Builder(ImmutableList.copyOf(command));
  }
@Test
  public void testBuild_invalidCommand() {
    try {
      DockerHealthCheck.fromCommand(ImmutableList.of());
      Assert.fail();
    } catch (IllegalArgumentException ex) {
      Assert.assertEquals("command must not be empty", ex.getMessage());
    }

    try {
      DockerHealthCheck.fromCommand(Arrays.asList("CMD", null));
      Assert.fail();
    } catch (IllegalArgumentException ex) {
      Assert.assertEquals("command must not contain null elements", ex.getMessage());
    }
  }