@Test public void propertyNotPresentOverwriteTest() throws IOException, SAXException, ParserConfigurationException, XmlPullParserException { PomAddProperty pomAddProperty = new PomAddProperty("foo", "bar").relative("pom.xml").overwriteIfPresent(); TOExecutionResult executionResult = pomAddProperty.execution(transformedAppFolder, transformationContext); assertEquals(executionResult.getType(), TOExecutionResult.Type.SUCCESS); assertNull(executionResult.getException()); assertEquals(executionResult.getWarnings().size(), 0); Model pomModelAfterChange = getTransformedPomModel("pom.xml"); assertEquals(pomModelAfterChange.getProperties().size(), 2); assertEquals(pomModelAfterChange.getProperties().getProperty("encoding"), "UTF-8"); assertEquals(pomModelAfterChange.getProperties().getProperty("foo"), "bar"); }
@Override public PomAddProperty overwriteIfPresent() { ifPresent = IfPresent.Overwrite; return this; }
PomAddProperty extends AbstractPomOperation<PomAddProperty> implements AddElement<PomAddProperty> { @Override public PomAddProperty overwriteIfPresent() { ifPresent = IfPresent.Overwrite; return this; } }
PomAddProperty extends AbstractPomOperation<PomAddProperty> implements AddElement<PomAddProperty> { @Override public PomAddProperty overwriteIfPresent() { ifPresent = IfPresent.Overwrite; return this; } PomAddProperty();  PomAddProperty(String propertyName, String propertyValue); }
PomAddProperty extends AbstractPomOperation<PomAddProperty> implements AddElement<PomAddProperty> { @Override public PomAddProperty overwriteIfPresent() { ifPresent = IfPresent.Overwrite; 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(); }
PomAddProperty extends AbstractPomOperation<PomAddProperty> implements AddElement<PomAddProperty> { @Override public PomAddProperty overwriteIfPresent() { ifPresent = IfPresent.Overwrite; 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();  }