Skip to content

Commit

Permalink
Added test
Browse files Browse the repository at this point in the history
  • Loading branch information
Shailesh Jagannath Padave authored and Shailesh Jagannath Padave committed Jan 9, 2025
1 parent d5d96a5 commit 16e2743
Showing 1 changed file with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import java.util.List;
import java.util.Set;

import com.netflix.conductor.common.metadata.tasks.TaskDef;
import org.junit.Test;

import com.netflix.conductor.common.metadata.tasks.TaskType;
Expand All @@ -29,6 +30,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;

public class WorkflowTaskTest {
Expand Down Expand Up @@ -76,4 +78,24 @@ public void testWorkflowTaskName() {
validationErrors.contains(
"WorkflowTask taskReferenceName name cannot be empty or null"));
}

@Test
public void testSetTaskDefinition() {
WorkflowTask workflowTask = new WorkflowTask();
TaskDef taskDef = new TaskDef();

// Case 1: taskDefinition is not null and taskDefinition.getName() is null
taskDef.setName(null);
workflowTask.setTaskDefinition(taskDef);
assertEquals(workflowTask.getName(), taskDef.getName());

// Case 2: taskDefinition is not null and taskDefinition.getName() is not null
taskDef.setName("existingName");
workflowTask.setTaskDefinition(taskDef);
assertEquals("existingName", taskDef.getName());

// Case 3: taskDefinition is null
workflowTask.setTaskDefinition(null);
assertNull(workflowTask.getTaskDefinition());
}
}

0 comments on commit 16e2743

Please sign in to comment.