The problem appears when future tries to finish itself and it trying to get lock when cache is already stopped. The only way to solve this issue is catching such assertion errors. At least, we are already catching some exceptions in the test.
But what about real situation? Should I add catch assert in the test or add cache check in transaction/future? java.lang.AssertionError: Lock is not owned for commit... Suppressed: java.lang.IllegalStateException: Grid is in invalid state to perform this operation. It either not started yet or has already being or have stopped [gridName=cache.GridCacheStopSelfTest0, state=STOPPED]