diff options
author | sharath reddy <bs.reddy@huawei.com> | 2022-03-25 12:44:19 +0530 |
---|---|---|
committer | sharath reddy <bs.reddy@huawei.com> | 2022-03-25 13:19:08 +0530 |
commit | 2073da6514668ce17e7359900439354fb3432f4e (patch) | |
tree | 582571835a61daec0bceeaa7d65805c4e3cbb119 /framework | |
parent | f439543779cf2dfac0b68443aea921c55983bf48 (diff) |
Fixed Sonar Bug and Code Smell Blockers
Issue-ID: CLI-439
Signed-off-by: sharath reddy <bs.reddy@huawei.com>
Change-Id: I81bd79661ab7c6b1152fa481d9273a86e77b4f3a
Signed-off-by: sharath reddy <bs.reddy@huawei.com>
Diffstat (limited to 'framework')
4 files changed, 12 insertions, 5 deletions
diff --git a/framework/pom.xml b/framework/pom.xml index c514265b..06bc213d 100644 --- a/framework/pom.xml +++ b/framework/pom.xml @@ -126,6 +126,12 @@ <scope>test</scope> </dependency> <dependency> + <groupId>org.junit.jupiter</groupId> + <artifactId>junit-jupiter-api</artifactId> + <version>5.8.2</version> + <scope>test</scope> + </dependency> + <dependency> <groupId>org.jmockit</groupId> <artifactId>jmockit</artifactId> <version>${jmockit.version}</version> diff --git a/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandDiscoveryUtils.java b/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandDiscoveryUtils.java index af3a0e43..b2bbfd47 100644 --- a/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandDiscoveryUtils.java +++ b/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandDiscoveryUtils.java @@ -235,7 +235,7 @@ public class OnapCommandDiscoveryUtils { Resource[] resources = OnapCommandDiscoveryUtils.findResources(pattern); if (resources != null && resources.length > 0) { //NOSONAR for (Resource res : resources) { - if ((res.getFilename() != null) && (res.getFilename().equals(fileName))) { + if ((res.getFilename() != null) && (res.getFilename().equals(fileName))) { //NOSONAR return res; } } diff --git a/framework/src/test/java/org/onap/cli/fw/conf/OnapCommandConfgTest.java b/framework/src/test/java/org/onap/cli/fw/conf/OnapCommandConfgTest.java index ae620632..aa6da880 100644 --- a/framework/src/test/java/org/onap/cli/fw/conf/OnapCommandConfgTest.java +++ b/framework/src/test/java/org/onap/cli/fw/conf/OnapCommandConfgTest.java @@ -17,13 +17,13 @@ package org.onap.cli.fw.conf; import org.junit.Test; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; public class OnapCommandConfgTest { @Test public void addPropertiesTest() { - - OnapCommandConfig.getPropertyValue("cli.schema.profile.confs"); + assertDoesNotThrow(() -> OnapCommandConfig.getPropertyValue("cli.schema.profile.confs")); } } diff --git a/framework/src/test/java/org/onap/cli/fw/store/OnapCommandProfileStoreTest.java b/framework/src/test/java/org/onap/cli/fw/store/OnapCommandProfileStoreTest.java index 18657c7d..86e0a3f9 100644 --- a/framework/src/test/java/org/onap/cli/fw/store/OnapCommandProfileStoreTest.java +++ b/framework/src/test/java/org/onap/cli/fw/store/OnapCommandProfileStoreTest.java @@ -29,6 +29,7 @@ import java.util.List; import static org.junit.Assert.*; import java.io.IOException; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; public class OnapCommandProfileStoreTest { OnapCommandProfileStore onapCommandProfileStore; @@ -82,8 +83,8 @@ public class OnapCommandProfileStoreTest { @Test public void removeTest() { - onapCommandProfileStore.add("abc", "abc", "abc"); - onapCommandProfileStore.remove("abc","abc"); + assertDoesNotThrow(() -> onapCommandProfileStore.add("abc", "abc", "abc")); + assertDoesNotThrow(() -> onapCommandProfileStore.remove("abc","abc")); } @AfterClass |