PomAddModule extends AbstractPomOperation<PomAddModule> implements AddElement<PomAddModule> { @Override public PomAddModule failIfPresent() { ifPresent = IfPresent.Fail; return this; } PomAddModule();  PomAddModule(String moduleName); @Override PomAddModule failIfPresent(); @Override PomAddModule warnNotAddIfPresent(); @Override PomAddModule warnButAddIfPresent(); @Override PomAddModule noOpIfPresent(); @Override PomAddModule overwriteIfPresent(); PomAddModule setModuleName(String moduleName); String getModuleName(); @Override String getDescription(); @Override boolean equals(Object obj); @Override int hashCode();  }
@Test public void moduleAlreadyPresentErrorTest() throws IOException { PomAddModule pomAddModule = new PomAddModule("module1").relative("pom.xml").failIfPresent(); TOExecutionResult executionResult = pomAddModule.execution(transformedAppFolder, transformationContext); assertEquals(executionResult.getType(), TOExecutionResult.Type.ERROR); assertEquals(executionResult.getException().getClass(), TransformationOperationException.class); assertEquals(executionResult.getException().getMessage(), "Module module1 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 PomAddModule("module1").relative("pom.xml").execution(transformedAppFolder, transformationContext).getType(), TOExecutionResult.Type.ERROR); }