diff --git a/features/update/task_failure/feature.java b/features/update/task_failure/feature.java index 964650aa..6bfcd14d 100644 --- a/features/update/task_failure/feature.java +++ b/features/update/task_failure/feature.java @@ -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; @@ -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