PomReplaceDependency extends AbstractArtifactPomOperation<PomReplaceDependency> implements ChangeOrRemoveElement<PomReplaceDependency> { @Override public PomReplaceDependency failIfNotPresent() { ifNotPresent = IfNotPresent.Fail; return this; } PomReplaceDependency();  PomReplaceDependency(String groupId, String artifactId, String newGroupId, String newArtifactId);  PomReplaceDependency(String groupId, String artifactId, String newGroupId, String newArtifactId, String newVersion);  PomReplaceDependency(String groupId, String artifactId, String newGroupId, String newArtifactId, String newVersion, String newScope); PomReplaceDependency setNewGroupId(String newGroupId); PomReplaceDependency setNewArtifactId(String newArtifactId); PomReplaceDependency setNewVersion(String newVersion); PomReplaceDependency setNewScope(String newScope); @Override PomReplaceDependency failIfNotPresent(); @Override PomReplaceDependency warnIfNotPresent(); @Override PomReplaceDependency noOpIfNotPresent(); String getNewGroupId(); String getNewArtifactId(); String getNewVersion(); String getNewScope(); @Override String getDescription();  }
@Test public void failNotPresentTest() throws IOException { PomReplaceDependency pomReplaceDependency = new PomReplaceDependency("foo", "bar", "newfoo", "newbar").relative("pom.xml").failIfNotPresent(); TOExecutionResult executionResult = pomReplaceDependency.execution(transformedAppFolder, transformationContext); assertEquals(executionResult.getType(), TOExecutionResult.Type.ERROR); assertEquals(executionResult.getException().getClass(), TransformationOperationException.class); assertEquals(executionResult.getException().getMessage(), "Dependency foo:bar has not been replaced by newfoo:newbar in POM file /pom.xml because it is not present"); assertNull(executionResult.getException().getCause()); assertNotChangedFile("pom.xml"); }