2929import com .bytechef .atlas .configuration .domain .Task ;
3030import com .bytechef .atlas .configuration .domain .WorkflowTask ;
3131import com .bytechef .atlas .coordinator .event .TaskExecutionCompleteEvent ;
32+ import com .bytechef .atlas .coordinator .event .TaskExecutionErrorEvent ;
3233import com .bytechef .atlas .coordinator .task .dispatcher .TaskDispatcher ;
3334import com .bytechef .atlas .execution .domain .Context ;
3435import com .bytechef .atlas .execution .domain .TaskExecution ;
4647import java .util .Arrays ;
4748import java .util .List ;
4849import java .util .Map ;
49- import org .junit .jupiter .api .Assertions ;
5050import org .junit .jupiter .api .Test ;
5151import org .springframework .boot .jackson .JsonComponentModule ;
5252import org .springframework .context .ApplicationEventPublisher ;
@@ -72,16 +72,16 @@ public class EachTaskDispatcherTest {
7272 }
7373
7474 @ Test
75- public void testDispatch1 () {
76- Assertions . assertThrows ( NullPointerException . class , () -> {
77- EachTaskDispatcher dispatcher = new EachTaskDispatcher (
78- contextService , counterService , SpelEvaluator .create (), eventPublisher , taskDispatcher ,
79- taskExecutionService , taskFileStorage );
80-
81- dispatcher .dispatch (TaskExecution .builder ()
82- .workflowTask (new WorkflowTask (Map .of (WorkflowConstants .NAME , "name" , WorkflowConstants .TYPE , "type" )))
83- .build ());
84- } );
75+ public void testEachTaskDispatcherWhenMissingRequiredParameter () {
76+
77+ EachTaskDispatcher dispatcher = new EachTaskDispatcher (
78+ contextService , counterService , SpelEvaluator .create (), eventPublisher , taskDispatcher ,
79+ taskExecutionService , taskFileStorage );
80+
81+ dispatcher .dispatch (TaskExecution .builder ()
82+ .workflowTask (new WorkflowTask (Map .of (WorkflowConstants .NAME , "name" , WorkflowConstants .TYPE , "type" )))
83+ .build ());
84+ verify ( eventPublisher , times ( 1 )). publishEvent ( any ( TaskExecutionErrorEvent . class ) );
8585 }
8686
8787 @ Test
0 commit comments