@ExtendWith(MockitoExtension.class)
public class LockTest {
- @SuppressWarnings("squid:S2276") // Remove this use of "Thread.sleep()".
+ @SuppressWarnings("squid:S2925") // "Thread.sleep" should not be used in tests.
private void sleep() {
try {
Thread.sleep(100);
} catch (InterruptedException e) {
+ // Do nothing.
}
}
private void asynchUnlock(Lock lock) {
- Thread t = new Thread(() -> {
+ Thread thread = new Thread(() -> {
sleep();
lock.unlockBlocking();
});
- t.start();
+ thread.start();
}
@Test