Skip to content

Commit 4e5f640

Browse files
committed
Addding a javadoc to SdkTestingExecutor
1 parent d6c797a commit 4e5f640

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

flytekit-testing/src/main/java/org/flyte/flytekit/testing/SdkTestingExecutor.java

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,37 @@ public static SdkTestingExecutor of(
116116
.build();
117117
}
118118

119+
/**
120+
* Creates a new {@link SdkTestingExecutor} for testing a {@link SdkDynamicWorkflowTask}.
121+
* This method wraps the given dynamic workflow task and its input into a delegating workflow,
122+
* allowing the task to be executed and tested in isolation.
123+
*
124+
* @param task the dynamic workflow task to test
125+
* @param input the input to the dynamic workflow task
126+
* @param outputType the expected output type of the dynamic workflow task
127+
* @param <InputT> the type of the input
128+
* @param <OutputT> the type of the output
129+
* @return a new {@link SdkTestingExecutor} instance
130+
*
131+
* <p>Example usage:
132+
* <pre>{@code
133+
* int expected = 6;
134+
*
135+
* SumIfEvenDynamicWorkflowTask.Output output =
136+
* SdkTestingExecutor.of(
137+
* new SumIfEvenDynamicWorkflowTask(),
138+
* SumIfEvenDynamicWorkflowTask.Input.create(of(2), of(4)),
139+
* JacksonSdkType.of(SumIfEvenDynamicWorkflowTask.Output.class))
140+
* .withTaskOutput(
141+
* new SumTask(),
142+
* SumTask.SumInput.create(of(2), of(4)),
143+
* SumTask.SumOutput.create(of(expected)))
144+
* .execute()
145+
* .getOutputAs(JacksonSdkType.of(SumIfEvenDynamicWorkflowTask.Output.class));
146+
*
147+
* assertEquals(expected, output.c().get());
148+
* }</pre>
149+
*/
119150
public static <InputT, OutputT> SdkTestingExecutor of(
120151
SdkDynamicWorkflowTask<InputT, OutputT> task, InputT input, SdkType<OutputT> outputType) {
121152
return of(new SdkDynamicWorkflowTaskDelegatingWorkflow<>(task, input, outputType));

0 commit comments

Comments
 (0)