Skip to content

Commit 2f15df0

Browse files
2465 - update test, dispatcher don't throw exceptions but they are handled through ExecutionErrorEventListener
1 parent 361f7e5 commit 2f15df0

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

server/libs/modules/task-dispatchers/each/src/test/java/com/bytechef/task/dispatcher/each/EachTaskDispatcherTest.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import com.bytechef.atlas.configuration.domain.Task;
3030
import com.bytechef.atlas.configuration.domain.WorkflowTask;
3131
import com.bytechef.atlas.coordinator.event.TaskExecutionCompleteEvent;
32+
import com.bytechef.atlas.coordinator.event.TaskExecutionErrorEvent;
3233
import com.bytechef.atlas.coordinator.task.dispatcher.TaskDispatcher;
3334
import com.bytechef.atlas.execution.domain.Context;
3435
import com.bytechef.atlas.execution.domain.TaskExecution;
@@ -46,7 +47,6 @@
4647
import java.util.Arrays;
4748
import java.util.List;
4849
import java.util.Map;
49-
import org.junit.jupiter.api.Assertions;
5050
import org.junit.jupiter.api.Test;
5151
import org.springframework.boot.jackson.JsonComponentModule;
5252
import 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

Comments
 (0)