TransformationUtility implements Cloneable { public final T dependsOn(String... dependencies) { if (dependencies != null) { for (String dependency : dependencies) { if (StringUtils.isBlank(dependency)) throw new IllegalArgumentException("Dependencies cannot be null nor blank"); } } this.dependencies = dependencies; 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 dependsOnTest() { TransformationUtility tuA = getNewTestTransformationUtility().setName("A"); TransformationUtility tuB = getNewTestTransformationUtility().setName("B"); tuB.dependsOn("A"); assertFalse(tuA.hasBeenPerformed()); PerformResult performResultA = tuA.perform(transformedAppFolder, transformationContext); assertTrue(tuA.hasBeenPerformed()); assertEquals(performResultA.getType(), PerformResult.Type.EXECUTION_RESULT); assertEquals(performResultA.getExecutionResult().getType(), TUExecutionResult.Type.VALUE); assertEquals(((TUExecutionResult) performResultA.getExecutionResult()).getValue(), transformedAppFolder); Mockito.when(transformationContext.getResult("A")).thenReturn(performResultA); assertFalse(tuB.hasBeenPerformed()); PerformResult performResultB = tuB.perform(transformedAppFolder, transformationContext); assertTrue(tuB.hasBeenPerformed()); assertEquals(performResultB.getType(), PerformResult.Type.EXECUTION_RESULT); assertEquals(performResultB.getExecutionResult().getType(), TUExecutionResult.Type.VALUE); assertEquals(((TUExecutionResult) performResultB.getExecutionResult()).getValue(), transformedAppFolder); }