From 6e22f6ba5a83c8e55bec56798e8e4c7a3d4b002b Mon Sep 17 00:00:00 2001 From: Taka Cho Date: Tue, 9 Jun 2020 11:21:31 -0400 Subject: reduce sonar issue - 2 rev In some conditions for assertTrue, sonarcloud recommends using assertEquals Assert.assertTrue(a.equals(b)); Assert.assertTrue(a == b); Assert.assertTrue(a == null); Assert.assertTrue(a != null); Assert.assertFalse(a.equals(b)); Compliant Solution Assert.assertEquals(a, b); Assert.assertSame(a, b); Assert.assertNull(a); Assert.assertNotNull(a); Assert.assertNotEquals(a, b); Issue-ID: POLICY-2616 Change-Id: Ib362573bd865d1b561916bf64640c8ddeaa02546 Signed-off-by: Taka Cho --- .../onap/policy/distributed/locking/DistributedLockManagerTest.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'feature-distributed-locking/src/test') diff --git a/feature-distributed-locking/src/test/java/org/onap/policy/distributed/locking/DistributedLockManagerTest.java b/feature-distributed-locking/src/test/java/org/onap/policy/distributed/locking/DistributedLockManagerTest.java index 5a0c6f77..48152715 100644 --- a/feature-distributed-locking/src/test/java/org/onap/policy/distributed/locking/DistributedLockManagerTest.java +++ b/feature-distributed-locking/src/test/java/org/onap/policy/distributed/locking/DistributedLockManagerTest.java @@ -27,6 +27,7 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNotSame; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; @@ -676,7 +677,7 @@ public class DistributedLockManagerTest { // new lock should succeed DistributedLock lock2 = getLock(RESOURCE, OWNER_KEY, HOLD_SEC, callback, false); - assertTrue(lock2 != lock); + assertNotSame(lock2, lock); assertTrue(lock2.isWaiting()); } -- cgit 1.2.3-korg