From 9a08d687e48312beef47bce357d374ede2ce0dc7 Mon Sep 17 00:00:00 2001 From: SravanKumarGunda Date: Tue, 14 Jul 2020 14:55:47 +0530 Subject: Code Improvements Signed-off-by: SravanKumarGunda Issue-ID: CLI-270 Change-Id: I3de621dab68f153c16a36102239b095c60abf9ab --- main/src/main/java/org/onap/cli/main/OnapCli.java | 6 +++--- .../org/onap/cli/main/interactive/StringCompleterTest.java | 13 ++++++------- .../test/java/org/onap/cli/main/utils/OnapCliUtilsTest.java | 4 ++-- 3 files changed, 11 insertions(+), 12 deletions(-) (limited to 'main') 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 paramCache = new HashMap<>(); + Map 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()); - assertTrue(result == 0); + assertEquals(0, result); result = com.complete(null, 1, new ArrayList()); - assertTrue(result == 0); + assertEquals(0, result); com.add("test", "testing1", "testing2"); result = com.complete("test", 1, new ArrayList()); - assertTrue(result == 0); + assertEquals(0, result); result = com.complete("sfds", 1, new ArrayList()); - assertTrue(result == -1); + assertEquals(-1, result); result = com.complete("test", 1, new ArrayList()); - 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 -- cgit 1.2.3-korg