@Test
  public void testBuild_simple()
      throws IOException, InterruptedException, DigestException, InvalidImageReferenceException {
    String targetImage =
        IntegrationTestingConfiguration.getTestRepositoryLocation()
            + "/simpleimage:gradle"
            + System.nanoTime();

    // Test empty output error
    Exception exception =
        assertThrows(
            UnexpectedBuildFailure.class,
            () ->
                simpleTestProject.build(
                    "clean",
                    "jib",
                    "-Djib.useOnlyProjectCache=true",
                    "-Djib.console=plain",
                    "-x=classes",
                    "-D_TARGET_IMAGE=" + targetImage));
    assertThat(exception)
        .hasMessageThat()
        .contains("No classes files were found - did you compile your project?");

    String output = JibRunHelper.buildAndRun(simpleTestProject, targetImage);
    assertThat(ImmutableList.copyOf(output.split("\n")))
        .containsExactly(
            "Hello, world. An argument.",
            "1970-01-01T00:00:01Z",
            "rw-r--r--",
            "rw-r--r--",
            "foo",
            "cat",
            "1970-01-01T00:00:01Z",
            "1970-01-01T00:00:01Z");

    String digest =
        readDigestFile(simpleTestProject.getProjectRoot().resolve("build/jib-image.digest"));
    String imageReferenceWithDigest =
        ImageReference.parse(targetImage).withQualifier(digest).toString();
    assertThat(JibRunHelper.pullAndRunBuiltImage(imageReferenceWithDigest)).isEqualTo(output);

    String id = readDigestFile(simpleTestProject.getProjectRoot().resolve("build/jib-image.id"));
    assertThat(id).isNotEqualTo(digest);
    assertThat(new Command("docker", "run", "--rm", id).run()).isEqualTo(output);

    assertDockerInspect(targetImage);
    assertThat(JibRunHelper.getCreationTime(targetImage)).isEqualTo(Instant.EPOCH);
    assertThat(getWorkingDirectory(targetImage)).isEqualTo("/home");
    assertThat(getEntrypoint(targetImage))
        .isEqualTo(
            "[java -cp /d1:/d2:/app/resources:/app/classes:/app/libs/* com.test.HelloWorld]");
    assertThat(getLayerSize(targetImage)).isEqualTo(10);
  }
Asserts that the test project has the required exposed ports, labels and volumes.

@param imageReference the image to test
@throws IOException if the {@code docker inspect} command fails to run
@throws InterruptedException if the {@code docker inspect} command is interrupted
jib-gradle-plugin/src/integration-test/java/com/google/cloud/tools/jib/gradle/SingleProjectIntegrationTest.java