OGM-630 Fix test failure on Jenkins

https://hibernate.atlassian.net/browse/OGM-630

I think the problem is that in one of the test in `OptimisticLockingTest` the threads ignore the latch.
The fix is in the first commit the second commit is just a refactoring that should make the test more readable and it is not required to fix the issue.

@gunnarmorling 
can you have a look this?