@Test
  public void testBuild_failOffline() {
    String targetImage =
        IntegrationTestingConfiguration.getTestRepositoryLocation()
            + "/simpleimageoffline:gradle"
            + System.nanoTime();

    Exception exception =
        assertThrows(
            UnexpectedBuildFailure.class,
            () ->
                simpleTestProject.build(
                    "--offline",
                    "clean",
                    "jib",
                    "-Djib.useOnlyProjectCache=true",
                    "-Djib.console=plain",
                    "-D_TARGET_IMAGE=" + targetImage));
    assertThat(exception)
        .hasMessageThat()
        .contains("Cannot build to a container registry in offline mode");
  }
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