Skip to content

Commit 16e2743

Browse files
Shailesh Jagannath PadaveShailesh Jagannath Padave
Shailesh Jagannath Padave
authored and
Shailesh Jagannath Padave
committed
Added test
1 parent d5d96a5 commit 16e2743

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

common/src/test/java/com/netflix/conductor/common/workflow/WorkflowTaskTest.java

+22
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import java.util.List;
1717
import java.util.Set;
1818

19+
import com.netflix.conductor.common.metadata.tasks.TaskDef;
1920
import org.junit.Test;
2021

2122
import com.netflix.conductor.common.metadata.tasks.TaskType;
@@ -29,6 +30,7 @@
2930
import static org.junit.Assert.assertEquals;
3031
import static org.junit.Assert.assertFalse;
3132
import static org.junit.Assert.assertNotNull;
33+
import static org.junit.Assert.assertNull;
3234
import static org.junit.Assert.assertTrue;
3335

3436
public class WorkflowTaskTest {
@@ -76,4 +78,24 @@ public void testWorkflowTaskName() {
7678
validationErrors.contains(
7779
"WorkflowTask taskReferenceName name cannot be empty or null"));
7880
}
81+
82+
@Test
83+
public void testSetTaskDefinition() {
84+
WorkflowTask workflowTask = new WorkflowTask();
85+
TaskDef taskDef = new TaskDef();
86+
87+
// Case 1: taskDefinition is not null and taskDefinition.getName() is null
88+
taskDef.setName(null);
89+
workflowTask.setTaskDefinition(taskDef);
90+
assertEquals(workflowTask.getName(), taskDef.getName());
91+
92+
// Case 2: taskDefinition is not null and taskDefinition.getName() is not null
93+
taskDef.setName("existingName");
94+
workflowTask.setTaskDefinition(taskDef);
95+
assertEquals("existingName", taskDef.getName());
96+
97+
// Case 3: taskDefinition is null
98+
workflowTask.setTaskDefinition(null);
99+
assertNull(workflowTask.getTaskDefinition());
100+
}
79101
}

0 commit comments

Comments
 (0)