static String buildAndRun(
      TestProject testProject,
      String imageReference,
      String gradleBuildFile,
      String... extraRunArguments)
      throws IOException, InterruptedException, DigestException {
    BuildResult buildResult =
        testProject.build(
            "clean",
            "jib",
            "-Djib.useOnlyProjectCache=true",
            "-Djib.console=plain",
            "-D_TARGET_IMAGE=" + imageReference,
            "-Djib.allowInsecureRegistries=" + imageReference.startsWith("localhost"),
            "-b=" + gradleBuildFile);
    assertBuildSuccess(buildResult, "jib", "Built and pushed image as ");
    assertThatExpectedImageDigestAndIdReturned(testProject.getProjectRoot());
    MatcherAssert.assertThat(buildResult.getOutput(), CoreMatchers.containsString(imageReference));

    return pullAndRunBuiltImage(imageReference, extraRunArguments);
  }
Helper class to run integration tests.
jib-gradle-plugin/src/integration-test/java/com/google/cloud/tools/jib/gradle/JibRunHelper.java