TransformationUtility implements Cloneable { T absolute(File file) { if (file == null) { String exceptionMessage = String.format("Absolute file for %s is null", name); throw new TransformationUtilityException(exceptionMessage); } absoluteFile = file; return (T) this; } @SuppressWarnings("PMD.UnnecessaryConstructor")  TransformationUtility(); final String getName(); T setContextAttributeName(String contextAttributeName); String getContextAttributeName(); final T setParent(TransformationUtilityParent parent, int order); TransformationUtilityParent getParent(); TransformationTemplate getTransformationTemplate(); abstract String getDescription(); int getOrder(); final T relative(String relativePath); final T set(String propertyName, String contextAttributeName); T absolute(String contextAttributeName); T absolute(String contextAttributeName, String additionalRelativePath); @SuppressFBWarnings("RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE") PerformResult perform(File transformedAppFolder, TransformationContext transformationContext); final T abortOnFailure(boolean abort); final T abortOnFailure(String abortionMessage); String getAbortionMessage(); final boolean isAbortOnFailure(); boolean isSaveResult(); final boolean hasBeenPerformed(); final T dependsOn(String... dependencies); final T executeIf(String conditionAttributeName); final T executeIf(UtilityCondition utilityCondition); final T executeUnless(String conditionAttributeName); String getIfConditionAttributeName(); String getUnlessConditionAttributeName(); final boolean isFileSet(); final boolean wasFileExplicitlySet(); @Override String toString(); @Override T clone(); T copy(); @Override @SuppressWarnings("PMD.SimplifyBooleanReturns") boolean equals(Object obj); @Override int hashCode();  }
@Test public void absoluteTest() { TransformationUtility transformationUtility = getNewTestTransformationUtility(); Mockito.when(transformationContext.contains("ATT")).thenReturn(true); Mockito.when(transformationContext.get("ATT")).thenReturn(new File(transformedAppFolder, "pom.xml")); assertEquals(transformationUtility.absolute("ATT"), transformationUtility); assertTrue(transformationUtility.wasFileExplicitlySet()); assertTrue(transformationUtility.isFileSet()); assertFalse(transformationUtility.hasBeenPerformed()); PerformResult performResult = transformationUtility.perform(transformedAppFolder, transformationContext); assertTrue(transformationUtility.hasBeenPerformed()); assertNotNull(performResult); assertEquals(performResult.getType(), PerformResult.Type.EXECUTION_RESULT); assertEquals(performResult.getExecutionResult().getType(), TUExecutionResult.Type.VALUE); TUExecutionResult executionResult = (TUExecutionResult) performResult.getExecutionResult(); assertEquals(executionResult.getValue(), new File(transformedAppFolder, "pom.xml")); }