How can i write tests for workflows in java sdk?

The only source of information is this link.

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.

Can you show your test code by chance? You can see a number of tests in java samples repo here if helps.