PomAddProperty extends AbstractPomOperation<PomAddProperty> implements AddElement<PomAddProperty> { @Override public PomAddProperty warnButAddIfPresent() { ifPresent = IfPresent.WarnButAdd; return this; } PomAddProperty();  PomAddProperty(String propertyName, String propertyValue); @Override PomAddProperty failIfPresent(); @Override PomAddProperty warnNotAddIfPresent(); @Override PomAddProperty warnButAddIfPresent(); @Override PomAddProperty noOpIfPresent(); @Override PomAddProperty overwriteIfPresent(); PomAddProperty setPropertyName(String propertyName); PomAddProperty setPropertyValue(String propertyValue); String getPropertyName(); String getPropertyValue(); @Override String getDescription(); @Override boolean equals(Object obj); @Override int hashCode();  }
@Test public void propertyAlreadyPresentOverwriteWarnTest() throws IOException, SAXException, ParserConfigurationException, XmlPullParserException { PomAddProperty pomAddProperty = new PomAddProperty("encoding", "bar").relative("pom.xml").warnButAddIfPresent(); TOExecutionResult executionResult = pomAddProperty.execution(transformedAppFolder, transformationContext); assertEquals(executionResult.getType(), TOExecutionResult.Type.WARNING); assertNull(executionResult.getException()); assertNotNull(executionResult.getWarnings()); assertEquals(executionResult.getWarnings().size(), 1); assertEquals(executionResult.getWarnings().get(0).getClass(), TransformationOperationException.class); assertEquals(executionResult.getWarnings().get(0).getMessage(), "Property encoding was already present in POM file pom.xml, but it was overwritten to bar"); Model pomModelAfterChange = getTransformedPomModel("pom.xml"); assertEquals(pomModelAfterChange.getProperties().size(), 1); assertEquals(pomModelAfterChange.getProperties().getProperty("encoding"), "bar"); }