diff options
author | Taka Cho <takamune.cho@att.com> | 2020-07-02 11:56:18 -0400 |
---|---|---|
committer | Taka Cho <takamune.cho@att.com> | 2020-07-02 12:34:49 -0400 |
commit | 427cbbb9e25f843bcf06d75904f6294ac07180be (patch) | |
tree | 46f4abb3a5be369874567bab0016102c6c7bc678 /feature-session-persistence/src | |
parent | 11fe26a917bdd6aa54aa40cb21396df824410d83 (diff) |
drools-pdp sonar fix
most of changes are assert statement
Issue-ID: POLICY-2616
Change-Id: I3bd3076115d28d8cfabcbe0859cc4b21085e1394
Signed-off-by: Taka Cho <takamune.cho@att.com>
Diffstat (limited to 'feature-session-persistence/src')
-rw-r--r-- | feature-session-persistence/src/test/java/org/onap/policy/drools/persistence/DroolsSessionEntityTest.java | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/feature-session-persistence/src/test/java/org/onap/policy/drools/persistence/DroolsSessionEntityTest.java b/feature-session-persistence/src/test/java/org/onap/policy/drools/persistence/DroolsSessionEntityTest.java index 8853edf2..3033a7bd 100644 --- a/feature-session-persistence/src/test/java/org/onap/policy/drools/persistence/DroolsSessionEntityTest.java +++ b/feature-session-persistence/src/test/java/org/onap/policy/drools/persistence/DroolsSessionEntityTest.java @@ -22,6 +22,7 @@ package org.onap.policy.drools.persistence; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertTrue; import java.util.Date; @@ -36,11 +37,11 @@ public class DroolsSessionEntityTest { DroolsSessionEntity e2 = makeEnt("mynameA", 2); // session id is not part of hash code - assertTrue(entity.hashCode() == e2.hashCode()); + assertEquals(entity.hashCode(), e2.hashCode()); // diff sess name e2 = makeEnt("mynameB", 1); - assertTrue(entity.hashCode() != e2.hashCode()); + assertNotEquals(entity.hashCode(), e2.hashCode()); } /** Ensures that hashCode() functions as expected when the getXxx methods are overridden. */ @@ -51,11 +52,11 @@ public class DroolsSessionEntityTest { DroolsSessionEntity e2 = makeEnt("mynameA", 2); // session id is not part of hash code - assertTrue(entity.hashCode() == e2.hashCode()); + assertEquals(entity.hashCode(), e2.hashCode()); // diff sess name e2 = makeEnt("mynameB", 1); - assertTrue(entity.hashCode() != e2.hashCode()); + assertNotEquals(entity.hashCode(), e2.hashCode()); } @Test @@ -103,21 +104,21 @@ public class DroolsSessionEntityTest { DroolsSessionEntity entity = makeEnt("mynameA", 1); // diff object type - assertFalse(entity.equals("hello")); + assertNotEquals(entity, "hello"); // reflexive - assertTrue(entity.equals(entity)); + assertEquals(entity, entity); DroolsSessionEntity e2 = makeEnt("mynameA", 2); // session id is not part of hash code - assertTrue(entity.equals(e2)); - assertTrue(entity.equals(e2)); + assertEquals(entity, e2); + assertEquals(entity, e2); // diff sess name e2 = makeEnt("mynameB", 1); - assertFalse(entity.equals(e2)); - assertFalse(entity.equals(e2)); + assertNotEquals(entity, e2); + assertNotEquals(entity, e2); } /** Ensures that equals() functions as expected when the getXxx methods are overridden. */ @@ -126,18 +127,18 @@ public class DroolsSessionEntityTest { DroolsSessionEntity entity = makeEnt2("mynameA", 1); // reflexive - assertTrue(entity.equals(entity)); + assertEquals(entity, entity); DroolsSessionEntity e2 = makeEnt("mynameA", 2); // session id is not part of hash code - assertTrue(entity.equals(e2)); - assertTrue(entity.equals(e2)); + assertEquals(entity, e2); + assertEquals(entity, e2); // diff sess name e2 = makeEnt("mynameB", 1); - assertFalse(entity.equals(e2)); - assertFalse(entity.equals(e2)); + assertNotEquals(entity, e2); + assertNotEquals(entity, e2); } @Test |