aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorSravanKumarGunda <sravan.kumar1@huawei.com>2020-07-14 14:55:47 +0530
committerSravanKumarGunda <sravan.kumar1@huawei.com>2020-07-14 19:22:59 +0530
commit9a08d687e48312beef47bce357d374ede2ce0dc7 (patch)
tree3717d377dd4ea90f4e88c28d52bb3c0d5d28f34c /main
parent5f23e02caa5ab128a4c01866dec91eaea8dc7cee (diff)
Code Improvements
Signed-off-by: SravanKumarGunda <sravan.kumar1@huawei.com> Issue-ID: CLI-270 Change-Id: I3de621dab68f153c16a36102239b095c60abf9ab
Diffstat (limited to 'main')
-rw-r--r--main/src/main/java/org/onap/cli/main/OnapCli.java6
-rw-r--r--main/src/test/java/org/onap/cli/main/interactive/StringCompleterTest.java13
-rw-r--r--main/src/test/java/org/onap/cli/main/utils/OnapCliUtilsTest.java4
3 files changed, 11 insertions, 12 deletions
diff --git a/main/src/main/java/org/onap/cli/main/OnapCli.java b/main/src/main/java/org/onap/cli/main/OnapCli.java
index b11b1b2b..061c1f7b 100644
--- a/main/src/main/java/org/onap/cli/main/OnapCli.java
+++ b/main/src/main/java/org/onap/cli/main/OnapCli.java
@@ -158,11 +158,11 @@ public class OnapCli {
}
protected void print(String msg) {
- System.out.println(msg);
+ System.out.println(msg); //NOSONAR
}
protected void printerr(String msg) {
- System.err.println(msg);
+ System.err.println(msg); //NOSONAR
}
private void print(Throwable throwable) {
@@ -515,7 +515,7 @@ public class OnapCli {
//refer params from profile
if (this.profile != null) {
- Map<String, String> paramCache = new HashMap<>();
+ Map<String, String> paramCache = new HashMap<>(); //NOSONAR
if (this.product == null)
paramCache = OnapCommandRegistrar.getRegistrar().getParamCache();
else
diff --git a/main/src/test/java/org/onap/cli/main/interactive/StringCompleterTest.java b/main/src/test/java/org/onap/cli/main/interactive/StringCompleterTest.java
index 32f3be8a..853ceb49 100644
--- a/main/src/test/java/org/onap/cli/main/interactive/StringCompleterTest.java
+++ b/main/src/test/java/org/onap/cli/main/interactive/StringCompleterTest.java
@@ -16,12 +16,11 @@
package org.onap.cli.main.interactive;
-import static org.junit.Assert.assertTrue;
-
import java.util.ArrayList;
import java.util.Arrays;
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
public class StringCompleterTest {
@@ -29,20 +28,20 @@ public class StringCompleterTest {
public void completeTest() {
StringCompleter com = new StringCompleter(Arrays.asList(new String[] { "test", "testing1", "testing2" }));
int result = com.complete("test", 1, new ArrayList<CharSequence>());
- assertTrue(result == 0);
+ assertEquals(0, result);
result = com.complete(null, 1, new ArrayList<CharSequence>());
- assertTrue(result == 0);
+ assertEquals(0, result);
com.add("test", "testing1", "testing2");
result = com.complete("test", 1, new ArrayList<CharSequence>());
- assertTrue(result == 0);
+ assertEquals(0, result);
result = com.complete("sfds", 1, new ArrayList<CharSequence>());
- assertTrue(result == -1);
+ assertEquals(-1, result);
result = com.complete("test", 1, new ArrayList<CharSequence>());
- assertTrue(result == 0);
+ assertEquals(0, result);
}
}
diff --git a/main/src/test/java/org/onap/cli/main/utils/OnapCliUtilsTest.java b/main/src/test/java/org/onap/cli/main/utils/OnapCliUtilsTest.java
index e74981fb..05249898 100644
--- a/main/src/test/java/org/onap/cli/main/utils/OnapCliUtilsTest.java
+++ b/main/src/test/java/org/onap/cli/main/utils/OnapCliUtilsTest.java
@@ -405,7 +405,7 @@ public class OnapCliUtilsTest {
paramslist.add(param1);
OnapCliArgsParser.populateParams(paramslist,
Arrays.asList("--yaml", "name", "--yaml", "test-schema"));
- Assert.assertTrue(paramslist.iterator().next().getValue().equals("test-schema"));
+ Assert.assertEquals("test-schema", paramslist.iterator().next().getValue());
}
@Test
public void testReadYamlStringFromUrlForFile() throws OnapCommandException {
@@ -417,6 +417,6 @@ public class OnapCliUtilsTest {
paramslist.add(param1);
OnapCliArgsParser.populateParams(paramslist,
Arrays.asList("--yaml", "main/src/test/resources/open-cli-schema/sample-test-schema.yaml", "--yaml", "test-schema"));
- Assert.assertTrue(paramslist.iterator().next().getValue().equals("test-schema"));
+ Assert.assertEquals("test-schema", paramslist.iterator().next().getValue());
}
} \ No newline at end of file