Source:
<code>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) { <START> assertEquals("Configuration error: Cannot use property " + ConfigHelper.EXTERNALCONFIG_ACTIVATION_PROPERTY + " on projects with multiple images without explicit image external configuration.", <END> 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); }</code><technical_language>I check parts a essential provide a meaningful context in error message. check is more robust changes wrt rewording of message. So, I prefer contains essential parts (like contains(ConfigHelper.EXTERNALCONFIG_ACTIVATION_PROPERTY))</technical_language>

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); }