@Test public void propertyAlreadyPresentErrorTest() throws IOException { PomAddProperty pomAddProperty = new PomAddProperty("encoding", "bar").relative("pom.xml").failIfPresent(); TOExecutionResult executionResult = pomAddProperty.execution(transformedAppFolder, transformationContext); assertEquals(executionResult.getType(), TOExecutionResult.Type.ERROR); assertEquals(executionResult.getException().getClass(), TransformationOperationException.class); assertEquals(executionResult.getException().getMessage(), "Property encoding was not added to POM file pom.xml because it is already present"); assertNull(executionResult.getException().getCause()); assertNull(executionResult.getDetails()); assertNotChangedFile("pom.xml"); assertEquals(new PomAddProperty("encoding", "bar").relative("pom.xml").execution(transformedAppFolder, transformationContext).getType(), TOExecutionResult.Type.ERROR); }
@Override public PomAddProperty failIfPresent() { ifPresent = IfPresent.Fail; return this; }
PomAddProperty extends AbstractPomOperation<PomAddProperty> implements AddElement<PomAddProperty> { @Override public PomAddProperty failIfPresent() { ifPresent = IfPresent.Fail; return this; } }
PomAddProperty extends AbstractPomOperation<PomAddProperty> implements AddElement<PomAddProperty> { @Override public PomAddProperty failIfPresent() { ifPresent = IfPresent.Fail; return this; } PomAddProperty();  PomAddProperty(String propertyName, String propertyValue); }
PomAddProperty extends AbstractPomOperation<PomAddProperty> implements AddElement<PomAddProperty> { @Override public PomAddProperty failIfPresent() { ifPresent = IfPresent.Fail; 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 failIfPresent() { ifPresent = IfPresent.Fail; 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();  }