# Testing for ActivityCompletionException on ActivityCompletionClient.complete

**URL:** <https://community.temporal.io/t/testing-for-activitycompletionexception-on-activitycompletionclient-complete/17852>\
**Category:** Community Support\
**Tags:** java-sdk, activity, testing\
**Created:** [July 4, 2025, 2:28pm UTC](https://community.temporal.io/t/testing-for-activitycompletionexception-on-activitycompletionclient-complete/17852 "2025-07-04T14:28:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![wundrian](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/wundrian/32/7471_2.png) [@wundrian](https://community.temporal.io/u/wundrian)\
**Post date:** [July 4, 2025, 2:28pm UTC](https://community.temporal.io/t/testing-for-activitycompletionexception-on-activitycompletionclient-complete/17852/1 "2025-07-04T14:28:46Z")

</div>

I’m building a Spring Boot app that, among other things, allows users to call a REST endpoint to trigger completion of activities that called `Activity.getExecutionContext().doNotCompleteOnReturn();` . We mostly use this for placeholder activities that are currently executed manually and will later be automated as part of the activity.

I want to test my implementation, and since `ActivityCompletionClient.complete` documents it throws `ActivityCompletionException` I looked into what I could do to provoke that.  
And I haven’t been very successful so far: I’m using `TestWorkflowExtension` and registered a workflow that calls an activity that throws an exception after calling `doNotCompleteOnReturn()`. That forces Temporal into a loop and ends in an `ActivityCompletionException` as desired. _However_ it takes over a minute to run and that’s not really feasible for a test.

And here’s the crux: if I set timeouts on the workflow and/or activity Temporal just culls the activity, ending in an `ActivityNotExistsException` instead.

Anybody else has a tip on how to provoke `ActivityCompletionException` in under a second?
