@Test
  public void testRunPluginExtensions_exceptionFromExtension() {
    FileNotFoundException fakeException = new FileNotFoundException();
    FooExtension extension =
        new FooExtension(
            (buildPlan, properties, extraConfig, gradleData, logger) -> {
              throw new JibPluginExtensionException(
                  JibGradlePluginExtension.class, "exception from extension", fakeException);
            });
    loadedExtensions = Arrays.asList(extension);

    try {
      gradleProjectProperties.runPluginExtensions(
          Arrays.asList(new FooExtensionConfig()), containerBuilder);
      Assert.fail();
    } catch (JibPluginExtensionException ex) {
      Assert.assertEquals("exception from extension", ex.getMessage());
      Assert.assertSame(fakeException, ex.getCause());
    }
  }
Plugin extension test for {@link GradleProjectProperties}.
jib-gradle-plugin/src/test/java/com/google/cloud/tools/jib/gradle/GradleProjectPropertiesExtensionTest.java