# How can i write tests for workflows in java sdk?

**URL:** <https://community.temporal.io/t/how-can-i-write-tests-for-workflows-in-java-sdk/17927>\
**Category:** Community Support\
**Tags:** java-sdk, testing\
**Created:** [July 15, 2025, 12:38pm UTC](https://community.temporal.io/t/how-can-i-write-tests-for-workflows-in-java-sdk/17927 "2025-07-15T12:38:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mahdi\_Rajabi](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/mahdi_rajabi/32/6801_2.png) [@Mahdi\_Rajabi](https://community.temporal.io/u/Mahdi_Rajabi)\
**Post date:** [July 15, 2025, 12:38pm UTC](https://community.temporal.io/t/how-can-i-write-tests-for-workflows-in-java-sdk/17927/1 "2025-07-15T12:38:51Z")

</div>

The only source of information is [this link](https://docs.temporal.io/develop/java/testing-suite#sample-unit-tests).

I wrote a test as mentioned in the above link, but when i run the test i see the logs of activity and workflow pullers starting but then the code gets stuck in a loop of restarting the workflow.

I tried putting some debug points in workflow code to see what happens and it seems like when workflow calls a method of my mocked activity, it just stops executing the workflow.

---

<div class="post-metadata">

**Author:** ![tihomir](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/tihomir/32/6580_2.png) [@tihomir](https://community.temporal.io/u/tihomir)\
**Post date:** [July 20, 2025, 2:30am UTC](https://community.temporal.io/t/how-can-i-write-tests-for-workflows-in-java-sdk/17927/2 "2025-07-20T02:30:52Z")

</div>

Can you show your test code by chance? You can see a number of tests in java samples repo [here](https://github.com/temporalio/samples-java/tree/main/core/src/test/java/io/temporal/samples) if helps.
