Skip to content

Commit

Permalink
Work around java sdk issue 1973 (#413)
Browse files Browse the repository at this point in the history
Work around java sdk issue 1973
  • Loading branch information
Quinn-With-Two-Ns authored Jan 19, 2024
1 parent e4113bd commit 0dfcb1a
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions features/update/task_failure/feature.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import io.temporal.workflow.UpdateMethod;
import io.temporal.workflow.UpdateValidatorMethod;
import io.temporal.workflow.Workflow;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.atomic.AtomicInteger;
import org.junit.jupiter.api.Assertions;

Expand Down Expand Up @@ -78,6 +79,18 @@ public Run execute(Runner runner) {
Assertions.assertEquals("Failure", ((ApplicationFailure) e.getCause()).getType());
Assertions.assertEquals(
"message='simulated 3', type='Failure', nonRetryable=false", e.getCause().getMessage());
} catch (RuntimeException e) {
// TODO(https://github.com/temporalio/sdk-java/issues/1973) The SDK should be unwrapping the
// ExecutionException.
Assertions.assertTrue(e.getCause() instanceof ExecutionException);
ExecutionException ee = (ExecutionException) e.getCause();
Assertions.assertTrue(ee.getCause() instanceof WorkflowUpdateException);
WorkflowUpdateException wue = (WorkflowUpdateException) ee.getCause();
Assertions.assertTrue(wue.getCause() instanceof ApplicationFailure);
Assertions.assertEquals("Failure", ((ApplicationFailure) wue.getCause()).getType());
Assertions.assertEquals(
"message='simulated 3', type='Failure', nonRetryable=false",
wue.getCause().getMessage());
}

// Check an update handle validator will fail on any exception
Expand Down

0 comments on commit 0dfcb1a

Please sign in to comment.