summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/RestServerPool.java3
-rw-r--r--feature-session-persistence/src/test/java/org/onap/policy/drools/persistence/DroolsSessionEntityTest.java31
-rw-r--r--policy-core/src/test/java/org/onap/policy/drools/core/DroolsContainerTest.java5
-rw-r--r--policy-core/src/test/java/org/onap/policy/drools/core/jmx/PdpJmxTest.java3
-rw-r--r--policy-management/src/test/java/org/onap/policy/drools/protocol/coders/ProtocolCoderToolsetTest.java6
-rw-r--r--policy-management/src/test/java/org/onap/policy/drools/system/PolicyEngineManagerTest.java4
-rw-r--r--policy-utils/src/test/java/org/onap/policy/drools/utils/TripleTest.java24
7 files changed, 39 insertions, 37 deletions
diff --git a/feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/RestServerPool.java b/feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/RestServerPool.java
index 636fa4d5..2c0a2544 100644
--- a/feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/RestServerPool.java
+++ b/feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/RestServerPool.java
@@ -343,8 +343,7 @@ public class RestServerPool {
)
@Produces(MediaType.TEXT_PLAIN)
public String bucketMessage(@QueryParam("keyword") String keyword,
- @QueryParam("message") String message)
- throws IOException {
+ @QueryParam("message") String message) {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
Bucket.bucketMessage(new PrintStream(bos, true), keyword, message);
return bos.toString(StandardCharsets.UTF_8);
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
diff --git a/policy-core/src/test/java/org/onap/policy/drools/core/DroolsContainerTest.java b/policy-core/src/test/java/org/onap/policy/drools/core/DroolsContainerTest.java
index 928af4de..939de08c 100644
--- a/policy-core/src/test/java/org/onap/policy/drools/core/DroolsContainerTest.java
+++ b/policy-core/src/test/java/org/onap/policy/drools/core/DroolsContainerTest.java
@@ -22,6 +22,7 @@ package org.onap.policy.drools.core;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
@@ -117,7 +118,7 @@ public class DroolsContainerTest {
try {
// fetch the session, and verify that it exists
PolicySession session = container.getPolicySession("session1");
- assertTrue(session != null);
+ assertNotNull(session);
// get all sessions, and verify that this one is the only one
{
@@ -279,7 +280,7 @@ public class DroolsContainerTest {
try {
// fetch the session, and verify that it exists
PolicySession session = container.getPolicySession("session1");
- assertTrue(session != null);
+ assertNotNull(session);
// get all sessions, and verify that this one is the only one
{
diff --git a/policy-core/src/test/java/org/onap/policy/drools/core/jmx/PdpJmxTest.java b/policy-core/src/test/java/org/onap/policy/drools/core/jmx/PdpJmxTest.java
index 0422b486..7b565f76 100644
--- a/policy-core/src/test/java/org/onap/policy/drools/core/jmx/PdpJmxTest.java
+++ b/policy-core/src/test/java/org/onap/policy/drools/core/jmx/PdpJmxTest.java
@@ -22,6 +22,7 @@ package org.onap.policy.drools.core.jmx;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import org.junit.Before;
@@ -40,7 +41,7 @@ public class PdpJmxTest {
public void testGetInstance() {
jmx = PdpJmx.getInstance();
assertNotNull(jmx);
- assertTrue(PdpJmx.getInstance() == jmx);
+ assertSame(jmx, PdpJmx.getInstance());
}
@Test
diff --git a/policy-management/src/test/java/org/onap/policy/drools/protocol/coders/ProtocolCoderToolsetTest.java b/policy-management/src/test/java/org/onap/policy/drools/protocol/coders/ProtocolCoderToolsetTest.java
index 7a5ed2c0..6b497fa3 100644
--- a/policy-management/src/test/java/org/onap/policy/drools/protocol/coders/ProtocolCoderToolsetTest.java
+++ b/policy-management/src/test/java/org/onap/policy/drools/protocol/coders/ProtocolCoderToolsetTest.java
@@ -176,9 +176,9 @@ public class ProtocolCoderToolsetTest {
tripleDecoded = (Triple<String, String, String>) coderToolset.decode(tripleEncoded);
- Assert.assertTrue(tripleDecoded.first().equals(triple.first()));
- Assert.assertTrue(tripleDecoded.second().equals(triple.second()));
- Assert.assertTrue(tripleDecoded.third().equals(triple.third()));
+ Assert.assertEquals(tripleDecoded.first(), triple.first());
+ Assert.assertEquals(tripleDecoded.second(), triple.second());
+ Assert.assertEquals(tripleDecoded.third(), triple.third());
coderFilters.getFilter().setRule("[?($.third =~ /.*v3.*/)]");
}
diff --git a/policy-management/src/test/java/org/onap/policy/drools/system/PolicyEngineManagerTest.java b/policy-management/src/test/java/org/onap/policy/drools/system/PolicyEngineManagerTest.java
index a999c718..f4876a95 100644
--- a/policy-management/src/test/java/org/onap/policy/drools/system/PolicyEngineManagerTest.java
+++ b/policy-management/src/test/java/org/onap/policy/drools/system/PolicyEngineManagerTest.java
@@ -519,7 +519,7 @@ public class PolicyEngineManagerTest {
verify(prov1).beforeConfigure(mgr, properties);
verify(prov2).beforeConfigure(mgr, properties);
- assertTrue(mgr.getProperties() == properties);
+ assertSame(properties, mgr.getProperties());
assertEquals(sources, mgr.getSources());
assertEquals(sinks, mgr.getSinks());
@@ -553,7 +553,7 @@ public class PolicyEngineManagerTest {
(prov, flag) -> when(prov.afterConfigure(mgr)).thenReturn(flag),
() -> mgr.configure(properties),
prov -> verify(prov).beforeConfigure(mgr, properties),
- () -> assertTrue(mgr.getProperties() == properties),
+ () -> assertSame(properties, mgr.getProperties()),
prov -> verify(prov).afterConfigure(mgr));
}
diff --git a/policy-utils/src/test/java/org/onap/policy/drools/utils/TripleTest.java b/policy-utils/src/test/java/org/onap/policy/drools/utils/TripleTest.java
index 7f04b163..b62c9530 100644
--- a/policy-utils/src/test/java/org/onap/policy/drools/utils/TripleTest.java
+++ b/policy-utils/src/test/java/org/onap/policy/drools/utils/TripleTest.java
@@ -31,32 +31,32 @@ public class TripleTest {
Triple<String, String, String> triple =
new Triple<>("one", "two", "three");
- Assert.assertTrue("one".equals(triple.first()));
- Assert.assertTrue("one".equals(triple.getFirst()));
+ Assert.assertEquals("one", triple.first());
+ Assert.assertEquals("one", triple.getFirst());
- Assert.assertTrue("two".equals(triple.second()));
- Assert.assertTrue("two".equals(triple.getSecond()));
+ Assert.assertEquals("two", triple.second());
+ Assert.assertEquals("two", triple.getSecond());
- Assert.assertTrue("three".equals(triple.third()));
- Assert.assertTrue("three".equals(triple.getThird()));
+ Assert.assertEquals("three", triple.third());
+ Assert.assertEquals("three", triple.getThird());
triple.first("I");
- Assert.assertTrue("I".equals(triple.first()));
+ Assert.assertEquals("I", triple.first());
triple.setFirst("1");
- Assert.assertTrue("1".equals(triple.first()));
+ Assert.assertEquals("1", triple.first());
triple.second("2");
- Assert.assertTrue("2".equals(triple.second()));
+ Assert.assertEquals("2", triple.second());
triple.setSecond("II");
- Assert.assertTrue("II".equals(triple.second()));
+ Assert.assertEquals("II", triple.second());
triple.third("3");
- Assert.assertTrue("3".equals(triple.third()));
+ Assert.assertEquals("3", triple.third());
triple.setThird("III");
- Assert.assertTrue("III".equals(triple.third()));
+ Assert.assertEquals("III", triple.third());
}
} \ No newline at end of file