summaryrefslogtreecommitdiffstats
path: root/feature-pooling-dmaap/src
diff options
context:
space:
mode:
authorLiam Fallon <liam.fallon@est.tech>2020-06-16 07:01:36 +0000
committerGerrit Code Review <gerrit@onap.org>2020-06-16 07:01:36 +0000
commit1fdba85a145be36060262d4575995a7752d7a396 (patch)
tree55de7f679aa4e46bc6244d280c276387e08a4017 /feature-pooling-dmaap/src
parent6218853b9a001ef74300ab7d243685950ef32ad6 (diff)
parent6e22f6ba5a83c8e55bec56798e8e4c7a3d4b002b (diff)
Merge "reduce sonar issue - 2 rev"
Diffstat (limited to 'feature-pooling-dmaap/src')
-rw-r--r--feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/PoolingFeatureTest.java3
-rw-r--r--feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/message/BucketAssignmentsTest.java33
2 files changed, 19 insertions, 17 deletions
diff --git a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/PoolingFeatureTest.java b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/PoolingFeatureTest.java
index ed9d1c9a..f9878a9d 100644
--- a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/PoolingFeatureTest.java
+++ b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/PoolingFeatureTest.java
@@ -22,6 +22,7 @@ package org.onap.policy.drools.pooling;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
@@ -131,7 +132,7 @@ public class PoolingFeatureTest {
String host2 = pool.getHost();
assertNotNull(host2);
- assertTrue(!host.equals(host2));
+ assertNotEquals(host, host2);
}
@Test
diff --git a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/message/BucketAssignmentsTest.java b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/message/BucketAssignmentsTest.java
index 50cab788..5eaeddca 100644
--- a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/message/BucketAssignmentsTest.java
+++ b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/message/BucketAssignmentsTest.java
@@ -23,6 +23,7 @@ package org.onap.policy.drools.pooling.message;
import static org.assertj.core.api.Assertions.assertThatCode;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
@@ -298,47 +299,47 @@ public class BucketAssignmentsTest {
// slightly different values (i.e., changed "def" to "eef")
asgn = new BucketAssignments(new String[] {"abc", null, "eef"});
- assertTrue(code != asgn.hashCode());
+ assertNotEquals(code, asgn.hashCode());
}
@Test
public void testEquals() {
// null object
BucketAssignments asgn = new BucketAssignments();
- assertFalse(asgn.equals(null));
+ assertNotEquals(asgn, null);
// same object
asgn = new BucketAssignments();
- assertTrue(asgn.equals(asgn));
+ assertEquals(asgn, asgn);
// different class of object
asgn = new BucketAssignments();
- assertFalse(asgn.equals("not an assignment object"));
+ assertNotEquals(asgn, "not an assignment object");
+
+ assertNotEquals(asgn, new BucketAssignments(new String[] {"abc"}));
// with null assignments
asgn = new BucketAssignments();
- assertTrue(asgn.equals(new BucketAssignments()));
-
- assertFalse(asgn.equals(new BucketAssignments(new String[] {"abc"})));
+ assertEquals(asgn, new BucketAssignments());
// with empty array
asgn = new BucketAssignments(new String[0]);
- assertTrue(asgn.equals(asgn));
+ assertEquals(asgn, asgn);
- assertFalse(asgn.equals(new BucketAssignments()));
- assertFalse(asgn.equals(new BucketAssignments(new String[] {"abc"})));
+ assertNotEquals(asgn, new BucketAssignments());
+ assertNotEquals(asgn, new BucketAssignments(new String[] {"abc"}));
// with null items
String[] arr = {"abc", null, "def"};
asgn = new BucketAssignments(arr);
- assertTrue(asgn.equals(asgn));
- assertTrue(asgn.equals(new BucketAssignments(arr)));
- assertTrue(asgn.equals(new BucketAssignments(new String[] {"abc", null, "def"})));
+ assertEquals(asgn, asgn);
+ assertEquals(asgn, new BucketAssignments(arr));
+ assertEquals(asgn, new BucketAssignments(new String[] {"abc", null, "def"}));
- assertFalse(asgn.equals(new BucketAssignments()));
- assertFalse(asgn.equals(new BucketAssignments(new String[] {"abc", null, "XYZ"})));
+ assertNotEquals(asgn, new BucketAssignments());
+ assertNotEquals(asgn, new BucketAssignments(new String[] {"abc", null, "XYZ"}));
- assertFalse(asgn.equals(new BucketAssignments()));
+ assertNotEquals(asgn, new BucketAssignments());
}
/**