Support for transient policies not recreated at synchronization
[nonrtric.git] / policy-agent / src / test / java / org / oransc / policyagent / repository / LockTest.java
index 825010a..5c1cc14 100644 (file)
@@ -36,19 +36,21 @@ import reactor.test.StepVerifier;
 @ExtendWith(MockitoExtension.class)
 public 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
@@ -71,10 +73,8 @@ public class LockTest {
         Lock lock = new Lock();
 
         Mono<Lock> seq = lock.lock(LockType.EXCLUSIVE) //
-            .doOnNext(l -> System.out.println("1 " + l)) //
             .flatMap(l -> lock.lock(LockType.EXCLUSIVE)) //
-            .flatMap(l -> lock.unlock()) //
-            .doOnNext(l -> System.out.println("2 " + l)); //
+            .flatMap(l -> lock.unlock());
 
         asynchUnlock(lock);
         StepVerifier.create(seq) //