X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=policy-agent%2Fsrc%2Ftest%2Fjava%2Forg%2Foransc%2Fpolicyagent%2Frepository%2FLockTest.java;h=fd75978566a5671f7f3972f830838f30f6141193;hb=2310d1c6a458bd12b2d1ff805f1bd12dcd536cfa;hp=814056b38ed0a40bc8fdd00b05c80669e0777ef1;hpb=9c86f9c3b94494d587e7ae7a61effe6515f11159;p=nonrtric.git diff --git a/policy-agent/src/test/java/org/oransc/policyagent/repository/LockTest.java b/policy-agent/src/test/java/org/oransc/policyagent/repository/LockTest.java index 814056b3..fd759785 100644 --- a/policy-agent/src/test/java/org/oransc/policyagent/repository/LockTest.java +++ b/policy-agent/src/test/java/org/oransc/policyagent/repository/LockTest.java @@ -34,26 +34,27 @@ import reactor.core.publisher.Mono; import reactor.test.StepVerifier; @ExtendWith(MockitoExtension.class) -public class LockTest { +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 - public void testLock() throws IOException, ServiceException { + void testLock() throws IOException, ServiceException { Lock lock = new Lock(); lock.lockBlocking(LockType.SHARED); lock.unlockBlocking(); @@ -68,7 +69,7 @@ public class LockTest { } @Test - public void testReactiveLock() { + void testReactiveLock() { Lock lock = new Lock(); Mono seq = lock.lock(LockType.EXCLUSIVE) //