Repository: GoogleContainerTools/jib
File: jib-core/src/integration-test/java/com/google/cloud/tools/jib/api/ContainerizerIntegrationTest.java (Java)

Code before:
        Collections.emptyList());

    String imageReference = "localhost:5000/testimage:testtag";
    new Command("docker", "pull", imageReference).run();
    Assert.assertEquals(
        "Hello, world. An argument.\n", new Command("docker", "run", "--rm", imageReference).run());
  }

  @Test
  public void testBuildToDockerDaemon()
      throws IOException, InterruptedException, ExecutionException, RegistryException,
          CacheDirectoryCreationException {
    buildDockerDaemonImage(
        ImageReference.of("gcr.io", "distroless/java", DISTROLESS_DIGEST),
        ImageReference.of(null, "testdocker", null),
        Collections.emptyList());

    progressChecker.checkCompletion();

    assertDockerInspect("testdocker");
    assertLayerSize(7, "testdocker");
    Assert.assertEquals(
        "Hello, world. An argument.\n", new Command("docker", "run", "--rm", "testdocker").run());
  }

  @Test
  public void testBuildToDockerDaemon_multipleTags()
      throws IOException, InterruptedException, ExecutionException, RegistryException,
          CacheDirectoryCreationException {
    String imageReference = "testdocker";
    buildDockerDaemonImage(
        ImageReference.of("gcr.io", "distroless/java", DISTROLESS_DIGEST),
        ImageReference.of(null, imageReference, null),
        Arrays.asList("testtag2", "testtag3"));

    assertDockerInspect(imageReference);
    Assert.assertEquals(
        "Hello, world. An argument.\n", new Command("docker", "run", "--rm", imageReference).run());
    assertDockerInspect(imageReference + ":testtag2");
    Assert.assertEquals(
        "Hello, world. An argument.\n",
        new Command("docker", "run", "--rm", imageReference + ":testtag2").run());
    assertDockerInspect(imageReference + ":testtag3");
    Assert.assertEquals(
        "Hello, world. An argument.\n",
        new Command("docker", "run", "--rm", imageReference + ":testtag3").run());
  }

  @Test
  public void testBuildTarball()
      throws IOException, InterruptedException, ExecutionException, RegistryException,

Review comment (refactor):
I know these methods were not introduced in this PR but since we are using a helper for the assert statements, could we make the name a bit more detailed? Something along the lines of `assertThatExpectedLayerSizeReturned` or `assertThatExpectedDockerInspectOutputReturned`.

Code after:
      throws InvalidImageReferenceException, IOException, InterruptedException, ExecutionException,
          RegistryException, CacheDirectoryCreationException {
    buildImage(
        ImageReference.parse("openjdk:8-jre-slim"),
        Containerizer.to(RegistryImage.named("localhost:5000/testimage:testtag")),
        Collections.emptyList());

    String imageReference = "localhost:5000/testimage:testtag";
    new Command("docker", "pull", imageReference).run();
    Assert.assertEquals(
        "Hello, world. An argument.\n", new Command("docker", "run", "--rm", imageReference).run());
  }

  @Test
  public void testBuildToDockerDaemon_multipleTags()
      throws IOException, InterruptedException, ExecutionException, RegistryException,
          CacheDirectoryCreationException, InvalidImageReferenceException {
    buildImage(
        ImageReference.of("gcr.io", "distroless/java", DISTROLESS_DIGEST),
        Containerizer.to(DockerDaemonImage.named("testdocker")),
        Arrays.asList("testtag2", "testtag3"));

    progressChecker.checkCompletion();

    assertLayerSize(7, "testdocker");
    assertDockerInspect("testdocker");
    assertDockerInspect("testdocker:testtag2");
    assertDockerInspect("testdocker:testtag3");
    Assert.assertEquals(
        "Hello, world. An argument.\n", new Command("docker", "run", "--rm", "testdocker").run());
    Assert.assertEquals(
        "Hello, world. An argument.\n",
        new Command("docker", "run", "--rm", "testdocker:testtag2").run());
    Assert.assertEquals(
        "Hello, world. An argument.\n",
        new Command("docker", "run", "--rm", "testdocker:testtag3").run());
  }

  @Test
  public void testBuildTarball()
      throws IOException, InterruptedException, ExecutionException, RegistryException,
          CacheDirectoryCreationException, InvalidImageReferenceException {
    Path outputPath = temporaryFolder.newFolder().toPath().resolve("test.tar");
    buildImage(
        ImageReference.of("gcr.io", "distroless/java", DISTROLESS_DIGEST),
        Containerizer.to(TarImage.at(outputPath).named("testtar")),
        Collections.emptyList());

    progressChecker.checkCompletion();

    new Command("docker", "load", "--input", outputPath.toString()).run();