diff options
author | waynedunican <wayne.dunican@est.tech> | 2024-08-12 21:18:12 +0100 |
---|---|---|
committer | waynedunican <wayne.dunican@est.tech> | 2024-08-13 09:21:16 +0100 |
commit | 63d23a4aa0f3aeae9d6470b95dfa8f87b2d85aa8 (patch) | |
tree | 74aa5c14f66dc5760eb00ea8f18c278174cbc56e /integrity-monitor/src/test | |
parent | 34cad0af615db1ed4b85b8e4e1b77d0948289eed (diff) |
Fix sonar issues in common
- SONAR Fix instanceOf issues
- SONAR Remove public modifiers
- SONAR Remove unused imports
- SONAR Remove exceptions that can't be thrown from method body
Issue-ID: POLICY-5106
Change-Id: I745d0101036d3421f02db22481514be0b79f5103
Signed-off-by: waynedunican <wayne.dunican@est.tech>
Diffstat (limited to 'integrity-monitor/src/test')
3 files changed, 7 insertions, 9 deletions
diff --git a/integrity-monitor/src/test/java/org/onap/policy/common/im/IntegrityMonitorTest.java b/integrity-monitor/src/test/java/org/onap/policy/common/im/IntegrityMonitorTest.java index 3c071f18..f866df47 100644 --- a/integrity-monitor/src/test/java/org/onap/policy/common/im/IntegrityMonitorTest.java +++ b/integrity-monitor/src/test/java/org/onap/policy/common/im/IntegrityMonitorTest.java @@ -559,7 +559,7 @@ class IntegrityMonitorTest extends IntegrityMonitorTestBase { @SuppressWarnings("rawtypes") List resourceList = query.getResultList(); if (resourceList.isEmpty()) { - logger.debug("Record not found, resourceName: " + resourceName); + logger.debug("Record not found, resourceName: {}", resourceName); fail("missing record"); } @@ -626,7 +626,7 @@ class IntegrityMonitorTest extends IntegrityMonitorTestBase { assertEquals(StateManagement.HOT_STANDBY, sme1.getStandbyStatus()); logger.debug("--"); } else { - logger.debug("Record not found, resourceName: " + resourceName); + logger.debug("Record not found, resourceName: {}", resourceName); fail("record not found"); } diff --git a/integrity-monitor/src/test/java/org/onap/policy/common/im/StateManagementEntityTest.java b/integrity-monitor/src/test/java/org/onap/policy/common/im/StateManagementEntityTest.java index 2670b704..266b3221 100644 --- a/integrity-monitor/src/test/java/org/onap/policy/common/im/StateManagementEntityTest.java +++ b/integrity-monitor/src/test/java/org/onap/policy/common/im/StateManagementEntityTest.java @@ -73,7 +73,7 @@ class StateManagementEntityTest extends IntegrityMonitorTestBase { } @Test - void testJpa() throws Exception { + void testJpa() { logger.debug("\n??? logger.infor StateManagementEntityTest: Entering\n\n"); // Define the resourceName for the StateManagement constructor diff --git a/integrity-monitor/src/test/java/org/onap/policy/common/im/StateManagementTest.java b/integrity-monitor/src/test/java/org/onap/policy/common/im/StateManagementTest.java index f43322de..5dfd01f3 100644 --- a/integrity-monitor/src/test/java/org/onap/policy/common/im/StateManagementTest.java +++ b/integrity-monitor/src/test/java/org/onap/policy/common/im/StateManagementTest.java @@ -99,7 +99,7 @@ class StateManagementTest extends IntegrityMonitorTestBase { logger.info("\n\nStateManagementTest: Exit\n\n"); } - private void test_1(final StateManagement sm) throws StateManagementException, IntegrityMonitorException { + private void test_1(final StateManagement sm) throws IntegrityMonitorException { logger.info("\n??? initial state"); assertEquals(UNLOCKED_ENABLED_NULL_NULL, makeString(sm)); @@ -167,7 +167,7 @@ class StateManagementTest extends IntegrityMonitorTestBase { assertEquals(UNLOCKED_ENABLED_NULL_HOTSTANDBY, makeString(sm2)); } - private void test_2(final StateManagement sm) throws StateManagementException, IntegrityMonitorException { + private void test_2(final StateManagement sm) throws IntegrityMonitorException { // D3 If demote() is called while standbyStatus is null and // adminState is locked or opState is disabled, // the state shall transition to coldstandby @@ -231,8 +231,7 @@ class StateManagementTest extends IntegrityMonitorTestBase { @Test @SuppressWarnings("unchecked") - void test_StateManagementInitialization_ThrowException_ifEntityManagerCreateQuerythrowsAnyException() - throws Exception { + void test_StateManagementInitialization_ThrowException_ifEntityManagerCreateQuerythrowsAnyException() { assertThatThrownBy(() -> { final EntityManager mockedEm = getMockedEntityManager(); final EntityManagerFactory mockedEmf = getMockedEntityManagerFactory(mockedEm); @@ -246,8 +245,7 @@ class StateManagementTest extends IntegrityMonitorTestBase { @Test @SuppressWarnings("unchecked") - void test_StateManagementInitialization_ThrowStateManagementException_ifEntityManagerThrowsAnyException() - throws Exception { + void test_StateManagementInitialization_ThrowStateManagementException_ifEntityManagerThrowsAnyException() { assertThatThrownBy(() -> { final EntityManager mockedEm = getMockedEntityManager(); final EntityManagerFactory mockedEmf = getMockedEntityManagerFactory(mockedEm); |