@Test
  public void testRunPluginExtensions_invalidBaseImageFromExtension() {
    FooExtension extension =
        new FooExtension(
            (buildPlan, properties, extraConfig, mavenData, logger) ->
                buildPlan.toBuilder().setBaseImage(" in*val+id").build());
    loadedExtensions = Arrays.asList(extension);

    try {
      mavenProjectProperties.runPluginExtensions(
          Arrays.asList(new FooExtensionConfig()), containerBuilder);
      Assert.fail();
    } catch (JibPluginExtensionException ex) {
      Assert.assertEquals("invalid base image reference:  in*val+id", ex.getMessage());
      MatcherAssert.assertThat(
          ex.getCause(), CoreMatchers.instanceOf(InvalidImageReferenceException.class));
    }
  }
Plugin extension test for {@link MavenProjectProperties}.
jib-maven-plugin/src/test/java/com/google/cloud/tools/jib/maven/MavenProjectPropertiesExtensionTest.java