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=4b8743ff1629ce4f9f9b0931201060e22283e04b;hb=964a97cbe18f38e8417366dfdf871fcfae908fc8;hp=ee7e04fd672afd03baa8dd344050fc510b1eea42;hpb=d898170a0bb639b85a7f8770ddab2a3ccd181cfb;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 ee7e04fd..4b8743ff 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: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(); @@ -64,11 +65,11 @@ public class LockTest { lock.lockBlocking(LockType.SHARED); lock.unlockBlocking(); - assertThat(lock.getLockCounter()).isEqualTo(0); + assertThat(lock.getLockCounter()).isZero(); } @Test - public void testReactiveLock() { + void testReactiveLock() { Lock lock = new Lock(); Mono seq = lock.lock(LockType.EXCLUSIVE) // @@ -81,7 +82,7 @@ public class LockTest { .expectNext(lock) // .verifyComplete(); - assertThat(lock.getLockCounter()).isEqualTo(0); + assertThat(lock.getLockCounter()).isZero(); }