PomAddProperty extends AbstractPomOperation<PomAddProperty> implements AddElement<PomAddProperty> { @Override public PomAddProperty warnNotAddIfPresent() { ifPresent = IfPresent.WarnNotAdd; 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 propertyAlreadyPresentNotAddWarnTest() throws IOException, SAXException, ParserConfigurationException { PomAddProperty pomAddProperty = new PomAddProperty("encoding", "bar").relative("pom.xml").warnNotAddIfPresent(); TOExecutionResult executionResult = pomAddProperty.execution(transformedAppFolder, transformationContext); assertEqualsXml("pom.xml"); 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 not added to POM file pom.xml because it is already present"); }