Source:
public void externalPropertyActivation() throws MojoFailureException { MavenProject project = new MavenProject(); project.getProperties().put(ConfigHelper.EXTERNALCONFIG_ACTIVATION_PROPERTY, "anything"); List<ImageConfiguration> images = Arrays.asList(new ImageConfiguration.Builder().name("test").build()); ConfigHelper.validateExternalPropertyActivation(project, images); images = Arrays.asList( new ImageConfiguration.Builder().name("test").build(), new ImageConfiguration.Builder().name("test2").build()); try { ConfigHelper.validateExternalPropertyActivation(project, images); fail(); }catch(MojoFailureException ex) { assertEquals("Configuration error: Cannot use property " + ConfigHelper.EXTERNALCONFIG_ACTIVATION_PROPERTY + " on projects with multiple images without explicit image external configuration.", ex.getMessage()); } Map<String, String> externalConfig = new HashMap<>(); images.get(0).setExternalConfiguration(externalConfig); externalConfig.put("type", "othermagic"); ConfigHelper.validateExternalPropertyActivation(project, images); externalConfig.put("type", "properties"); externalConfig.put("prefix", "docker2"); ConfigHelper.validateExternalPropertyActivation(project, images); externalConfig.remove("prefix"); try { ConfigHelper.validateExternalPropertyActivation(project, images); fail(); }catch(MojoFailureException ex) { assertEquals("Configuration error: Cannot use property " + ConfigHelper.EXTERNALCONFIG_ACTIVATION_PROPERTY + " on projects with multiple images without explicit image external configuration.", ex.getMessage()); } project.getProperties().clear(); ConfigHelper.validateExternalPropertyActivation(project, images); project.getProperties().put(ConfigHelper.EXTERNALCONFIG_ACTIVATION_PROPERTY, "skip"); ConfigHelper.validateExternalPropertyActivation(project, images); }

Target:
public void externalPropertyActivation() throws MojoFailureException { MavenProject project = new MavenProject(); project.getProperties().put(ConfigHelper.EXTERNALCONFIG_ACTIVATION_PROPERTY, "anything"); List<ImageConfiguration> images = Arrays.asList(new ImageConfiguration.Builder().name("test").build()); ConfigHelper.validateExternalPropertyActivation(project, images); images = Arrays.asList( new ImageConfiguration.Builder().name("test").build(), new ImageConfiguration.Builder().name("test2").build()); try { ConfigHelper.validateExternalPropertyActivation(project, images); fail(); }catch(MojoFailureException ex) { assertTrue(ex.getMessage().contains("Cannot use property " + ConfigHelper.EXTERNALCONFIG_ACTIVATION_PROPERTY + " on projects with multiple images")); } Map<String, String> externalConfig = new HashMap<>(); images.get(0).setExternalConfiguration(externalConfig); externalConfig.put("type", "othermagic"); ConfigHelper.validateExternalPropertyActivation(project, images); externalConfig.put("type", "properties"); externalConfig.put("prefix", "docker"); ConfigHelper.validateExternalPropertyActivation(project, images); externalConfig.remove("prefix"); try { ConfigHelper.validateExternalPropertyActivation(project, images); fail(); }catch(MojoFailureException ex) { assertTrue(ex.getMessage().contains("Cannot use property " + ConfigHelper.EXTERNALCONFIG_ACTIVATION_PROPERTY + " on projects with multiple images")); } project.getProperties().clear(); ConfigHelper.validateExternalPropertyActivation(project, images); project.getProperties().put(ConfigHelper.EXTERNALCONFIG_ACTIVATION_PROPERTY, "skip"); ConfigHelper.validateExternalPropertyActivation(project, images); }