@Test public void overwriteIfPresentTest() throws IOException, XmlPullParserException { PomAddDependency uut = new PomAddDependency("xmlunit", "xmlunit", "1.7").relative("pom.xml").overwriteIfPresent().setScope("test"); TOExecutionResult executionResult = uut.execution(transformedAppFolder, transformationContext); Assert.assertEquals(executionResult.getType(), TOExecutionResult.Type.SUCCESS); Assert.assertNull(executionResult.getException()); Dependency dependencyAfterChange = getDependencyInList(getTransformedPomModel("pom.xml"), "xmlunit", "xmlunit", "1.7"); Assert.assertNotNull(dependencyAfterChange); Assert.assertEquals(dependencyAfterChange.getScope(), "test"); }
@Override public PomAddDependency overwriteIfPresent() { ifPresent = IfPresent.Overwrite; return this; }
PomAddDependency extends AbstractArtifactPomOperation<PomAddDependency> implements AddElement<PomAddDependency> { @Override public PomAddDependency overwriteIfPresent() { ifPresent = IfPresent.Overwrite; return this; } }
PomAddDependency extends AbstractArtifactPomOperation<PomAddDependency> implements AddElement<PomAddDependency> { @Override public PomAddDependency overwriteIfPresent() { ifPresent = IfPresent.Overwrite; return this; } PomAddDependency();  PomAddDependency(String groupId, String artifactId);  PomAddDependency(String groupId, String artifactId, String version);  PomAddDependency(String groupId, String artifactId, String version, String scope); }
PomAddDependency extends AbstractArtifactPomOperation<PomAddDependency> implements AddElement<PomAddDependency> { @Override public PomAddDependency overwriteIfPresent() { ifPresent = IfPresent.Overwrite; return this; } PomAddDependency();  PomAddDependency(String groupId, String artifactId);  PomAddDependency(String groupId, String artifactId, String version);  PomAddDependency(String groupId, String artifactId, String version, String scope); PomAddDependency setVersion(String version); PomAddDependency setScope(String scope); @Override PomAddDependency failIfPresent(); @Override PomAddDependency warnNotAddIfPresent(); @Override PomAddDependency warnButAddIfPresent(); @Override PomAddDependency noOpIfPresent(); @Override PomAddDependency overwriteIfPresent(); String getVersion(); String getScope(); @Override String getDescription(); }
PomAddDependency extends AbstractArtifactPomOperation<PomAddDependency> implements AddElement<PomAddDependency> { @Override public PomAddDependency overwriteIfPresent() { ifPresent = IfPresent.Overwrite; return this; } PomAddDependency();  PomAddDependency(String groupId, String artifactId);  PomAddDependency(String groupId, String artifactId, String version);  PomAddDependency(String groupId, String artifactId, String version, String scope); PomAddDependency setVersion(String version); PomAddDependency setScope(String scope); @Override PomAddDependency failIfPresent(); @Override PomAddDependency warnNotAddIfPresent(); @Override PomAddDependency warnButAddIfPresent(); @Override PomAddDependency noOpIfPresent(); @Override PomAddDependency overwriteIfPresent(); String getVersion(); String getScope(); @Override String getDescription();  }