Skip to content

Commit ba7fb76

Browse files
committed
Check that locks are acquired in order
1 parent 4bf6044 commit ba7fb76

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/CompositeLockTests.java

+6-3
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,15 @@
3333
class CompositeLockTests {
3434

3535
@Test
36-
void acquiresAllLocks() throws Exception {
37-
ReentrantLock lock1 = new ReentrantLock();
38-
ReentrantLock lock2 = new ReentrantLock();
36+
void acquiresAllLocksInOrder() throws Exception {
37+
ReentrantLock lock1 = spy(new ReentrantLock());
38+
ReentrantLock lock2 = spy(new ReentrantLock());
3939

4040
new CompositeLock(asList(lock1, lock2)).acquire();
4141

42+
InOrder inOrder = inOrder(lock1, lock2);
43+
inOrder.verify(lock1).lockInterruptibly();
44+
inOrder.verify(lock2).lockInterruptibly();
4245
assertTrue(lock1.isLocked());
4346
assertTrue(lock2.isLocked());
4447
}

0 commit comments

Comments
 (0)