Source:
public void checkAcquireLockFailure() { assertTrue(LockManagerFactory.getLockManager().acquireLock(updateLock1).getFirst()); assertFalse(LockManagerFactory.getLockManager().acquireLock(lockLock1).getFirst()); LockManagerFactory.getLockManager().releaseLock(updateLock1); assertTrue(LockManagerFactory.getLockManager().acquireLock(lockLock1).getFirst()); LockManagerFactory.getLockManager().releaseLock(lockLock1); assertTrue(LockManagerFactory.getLockManager().acquireLock(updateAndLockLock).getFirst()); Pair<Boolean, Set<String>> lockResult = LockManagerFactory.getLockManager().acquireLock(lockLock1); assertFalse(lockResult.getFirst()); assertTrue(lockResult.getSecond().contains(ERROR1)); assertEquals(lockResult.getSecond().size(), 1); lockResult = LockManagerFactory.getLockManager().acquireLock(updateLock2); assertFalse(lockResult.getFirst()); assertTrue(lockResult.getSecond().contains(ERROR2)); assertEquals(lockResult.getSecond().size(), 1); LockManagerFactory.getLockManager().releaseLock(updateAndLockLock); assertTrue(LockManagerFactory.getLockManager().acquireLock(lockLock1).getFirst()); assertTrue(LockManagerFactory.getLockManager().acquireLock(updateLock2).getFirst()); LockManagerFactory.getLockManager().releaseLock(lockLock1); LockManagerFactory.getLockManager().releaseLock(updateLock2); }

Target:
public void checkAcquireLockFailure() { assertTrue(LockManagerFactory.getLockManager().acquireLock(updateLock1).getFirst()); assertFalse(LockManagerFactory.getLockManager().acquireLock(lockLock1).getFirst()); LockManagerFactory.getLockManager().releaseLock(updateLock1); assertTrue(LockManagerFactory.getLockManager().acquireLock(lockLock1).getFirst()); LockManagerFactory.getLockManager().releaseLock(lockLock1); assertTrue(LockManagerFactory.getLockManager().acquireLock(updateAndLockLock).getFirst()); Pair<Boolean, Set<String>> lockResult = LockManagerFactory.getLockManager().acquireLock(lockLock1); assertFalse(lockResult.getFirst()); assertTrue(lockResult.getSecond().contains(ERROR1)); assertEquals(lockResult.getSecond().size(), 1); lockResult = LockManagerFactory.getLockManager().acquireLock(updateLock2); assertFalse(lockResult.getFirst()); assertTrue(lockResult.getSecond().contains(ERROR2)); assertEquals(lockResult.getSecond().size(), 1); LockManagerFactory.getLockManager().releaseLock(updateAndLockLock); assertTrue(LockManagerFactory.getLockManager().acquireLock(lockLock1).getFirst()); assertTrue(LockManagerFactory.getLockManager().acquireLock(updateLock2).getFirst()); LockManagerFactory.getLockManager().releaseLock(lockLock1); LockManagerFactory.getLockManager().releaseLock(updateLock2); assertTrue(LockManagerFactory.getLockManager().acquireLock(updateAndLockLock).getFirst()); assertTrue(LockManagerFactory.getLockManager().acquireLock(updateLock3).getFirst()); lockResult = LockManagerFactory.getLockManager().acquireLock(failLockLock); assertFalse(lockResult.getFirst()); assertTrue(lockResult.getSecond().contains(ERROR1)); assertTrue(lockResult.getSecond().contains(ERROR3)); assertEquals(lockResult.getSecond().size(), 2); LockManagerFactory.getLockManager().releaseLock(updateAndLockLock); LockManagerFactory.getLockManager().releaseLock(updateLock3); }