Hi Adithya,
Thanks for your message. I just spent quite some time trying to reproduce the issue and after tweaking a ton of things, I could, indeed. Having said so, may I ask you to please use our official MCVE template in the future:
MCVE stands for "Minimal, Complete, Verifiable Example". Yours is "C" and "V", but not M. I had to remove tons of things, set up databases manually, tweak configuration, passwords, etc. and set up test data by hand, because your test didn't do that.
Only to find out that something was simply wrong with your test setup itself. Adding the following line to the test itself "fixes" the test:
context.settings().withExecuteWithOptimisticLocking(true)
One reason why I keep recommending using our MCVE template is because when trying to create a Minimal example, this kind of mistake is easily detected as you remove unnecessary things to make it minimal, and then suddenly, the test works.
I hope this helps,
Lukas