|
16 | 16 | package io.serverlessworkflow.impl.test; |
17 | 17 |
|
18 | 18 | import static io.serverlessworkflow.api.WorkflowReader.readWorkflowFromClasspath; |
| 19 | +import static org.assertj.core.api.Assertions.assertThatThrownBy; |
19 | 20 |
|
20 | 21 | import com.fasterxml.jackson.databind.JsonNode; |
21 | 22 | import io.serverlessworkflow.impl.WorkflowApplication; |
| 23 | +import io.serverlessworkflow.impl.WorkflowException; |
22 | 24 | import io.serverlessworkflow.impl.WorkflowModel; |
23 | 25 | import io.serverlessworkflow.impl.jackson.JsonUtils; |
24 | 26 | import java.io.IOException; |
|
32 | 34 | import org.junit.jupiter.api.AfterEach; |
33 | 35 | import org.junit.jupiter.api.BeforeAll; |
34 | 36 | import org.junit.jupiter.api.BeforeEach; |
| 37 | +import org.junit.jupiter.api.Test; |
35 | 38 | import org.junit.jupiter.params.ParameterizedTest; |
36 | 39 | import org.junit.jupiter.params.provider.ValueSource; |
37 | 40 |
|
@@ -84,4 +87,23 @@ void testRetry(String path) throws IOException { |
84 | 87 | .atMost(Duration.ofSeconds(1)) |
85 | 88 | .until(() -> future.join().as(JsonNode.class).orElseThrow().equals(result)); |
86 | 89 | } |
| 90 | + |
| 91 | + @Test |
| 92 | + void testRetryEnd() throws IOException { |
| 93 | + apiServer.enqueue(new MockResponse().setResponseCode(404)); |
| 94 | + apiServer.enqueue(new MockResponse().setResponseCode(404)); |
| 95 | + apiServer.enqueue(new MockResponse().setResponseCode(404)); |
| 96 | + apiServer.enqueue(new MockResponse().setResponseCode(404)); |
| 97 | + apiServer.enqueue(new MockResponse().setResponseCode(404)); |
| 98 | + apiServer.enqueue(new MockResponse().setResponseCode(404)); |
| 99 | + assertThatThrownBy( |
| 100 | + () -> |
| 101 | + app.workflowDefinition( |
| 102 | + readWorkflowFromClasspath( |
| 103 | + "workflows-samples/try-catch-retry-reusable.yaml")) |
| 104 | + .instance(Map.of()) |
| 105 | + .start() |
| 106 | + .join()) |
| 107 | + .hasCauseInstanceOf(WorkflowException.class); |
| 108 | + } |
87 | 109 | } |
0 commit comments