From 72cf248dced4e272e69a8c48f5ee24c9d345f41d Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Tue, 25 Aug 2020 17:05:37 -0400 Subject: Address more sonars in drools-pdp Addressed the following sonars: - either log or rethrow - call "remove()" for thread-local-storage - use assertEquals - only one method call in exception test - swap arguments in assertEquals - add assertion to assertThatThrownBy() - explain @Ignore Also addressed eclipse warnings: - unused fields and methods Issue-ID: POLICY-2616 Change-Id: I6590c0d2b103885bc933014d48bf5fd92401cd80 Signed-off-by: Jim Hahn --- .../java/org/onap/policy/drools/core/PolicySessionTest.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'policy-core/src/test/java') diff --git a/policy-core/src/test/java/org/onap/policy/drools/core/PolicySessionTest.java b/policy-core/src/test/java/org/onap/policy/drools/core/PolicySessionTest.java index 63c71608..3b882195 100644 --- a/policy-core/src/test/java/org/onap/policy/drools/core/PolicySessionTest.java +++ b/policy-core/src/test/java/org/onap/policy/drools/core/PolicySessionTest.java @@ -102,7 +102,7 @@ public class PolicySessionTest { } @Test - public void testSetPolicySession_testGetCurrentSession() { + public void testSetPolicySession_testGetCurrentSession_testRemovePolicySession() { PolicySession sess2 = new PolicySession(MY_NAME + "-b", container, kie); session.setPolicySession(); @@ -110,6 +110,14 @@ public class PolicySessionTest { sess2.setPolicySession(); assertEquals(sess2, PolicySession.getCurrentSession()); + + // remove a different session - should be unchanged + session.removePolicySession(); + assertEquals(sess2, PolicySession.getCurrentSession()); + + // remove the session + sess2.removePolicySession(); + assertNull(PolicySession.getCurrentSession()); } @Test -- cgit 1.2.3-korg