aboutsummaryrefslogtreecommitdiffstats
path: root/framework/src/test/java/org
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 /framework/src/test/java/org
parent5f23e02caa5ab128a4c01866dec91eaea8dc7cee (diff)
Code Improvements
Signed-off-by: SravanKumarGunda <sravan.kumar1@huawei.com> Issue-ID: CLI-270 Change-Id: I3de621dab68f153c16a36102239b095c60abf9ab
Diffstat (limited to 'framework/src/test/java/org')
-rw-r--r--framework/src/test/java/org/onap/cli/fw/cmd/OnapSchemaValidateCommandTest.java4
-rw-r--r--framework/src/test/java/org/onap/cli/fw/info/OnapCommandInfoTest.java6
-rw-r--r--framework/src/test/java/org/onap/cli/fw/input/OnapCommandParameterTest.java11
-rw-r--r--framework/src/test/java/org/onap/cli/fw/input/ParameterTypeTest.java3
-rw-r--r--framework/src/test/java/org/onap/cli/fw/output/OnapCommandResultAttributeTest.java3
-rw-r--r--framework/src/test/java/org/onap/cli/fw/output/OnapCommandResultTest.java12
-rw-r--r--framework/src/test/java/org/onap/cli/fw/output/PrintDirectionTest.java3
-rw-r--r--framework/src/test/java/org/onap/cli/fw/output/print/OnapCommandPrintTest.java2
-rw-r--r--framework/src/test/java/org/onap/cli/fw/registrar/OnapCommandRegistrarTest.java2
-rw-r--r--framework/src/test/java/org/onap/cli/fw/schema/ValidateSchemaTest.java3
-rw-r--r--framework/src/test/java/org/onap/cli/fw/utils/OnapCommandUtilsTest.java6
11 files changed, 30 insertions, 25 deletions
diff --git a/framework/src/test/java/org/onap/cli/fw/cmd/OnapSchemaValidateCommandTest.java b/framework/src/test/java/org/onap/cli/fw/cmd/OnapSchemaValidateCommandTest.java
index f094203b..5b5c6fac 100644
--- a/framework/src/test/java/org/onap/cli/fw/cmd/OnapSchemaValidateCommandTest.java
+++ b/framework/src/test/java/org/onap/cli/fw/cmd/OnapSchemaValidateCommandTest.java
@@ -27,7 +27,7 @@ public class OnapSchemaValidateCommandTest {
@Ignore
@Test
- public void validateSchemaCommandTest1() throws OnapCommandException {
+ public void validateSchemaCommandTest1() throws OnapCommandException { //NOSONAR
OnapCommand cmd = OnapCommandRegistrar.getRegistrar().get("schema-validate");
cmd.getParametersMap().get("schema-location").setValue("schema-validate-pass.yaml");
cmd.getParametersMap().get("internal-schema").setValue("true");
@@ -36,7 +36,7 @@ public class OnapSchemaValidateCommandTest {
@Ignore
@Test
- public void validateSchemaCommandTest2() throws OnapCommandException {
+ public void validateSchemaCommandTest2() throws OnapCommandException { //NOSONAR
OnapCommand cmd = OnapCommandRegistrar.getRegistrar().get("schema-validate");
cmd.getParametersMap().get("schema-location").setValue(
ValidateSchemaTest.class.getClassLoader().getResource("schema-validate-pass.yaml").getFile());
diff --git a/framework/src/test/java/org/onap/cli/fw/info/OnapCommandInfoTest.java b/framework/src/test/java/org/onap/cli/fw/info/OnapCommandInfoTest.java
index 337ee1a5..3e9cfd72 100644
--- a/framework/src/test/java/org/onap/cli/fw/info/OnapCommandInfoTest.java
+++ b/framework/src/test/java/org/onap/cli/fw/info/OnapCommandInfoTest.java
@@ -16,7 +16,7 @@
package org.onap.cli.fw.info;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertEquals;
import org.junit.Test;
import org.onap.cli.fw.cmd.OnapCommandType;
@@ -31,8 +31,8 @@ public class OnapCommandInfoTest {
info.setProduct("open-cli");
info.setService("test");
- assertTrue(info.getCommandType().equals(OnapCommandType.CMD));
- assertTrue(info.getState().equals(OnapCommandState.STABLE));
+ assertEquals(OnapCommandType.CMD, info.getCommandType());
+ assertEquals(OnapCommandState.STABLE, info.getState());
}
}
diff --git a/framework/src/test/java/org/onap/cli/fw/input/OnapCommandParameterTest.java b/framework/src/test/java/org/onap/cli/fw/input/OnapCommandParameterTest.java
index 1bf42e00..17d14235 100644
--- a/framework/src/test/java/org/onap/cli/fw/input/OnapCommandParameterTest.java
+++ b/framework/src/test/java/org/onap/cli/fw/input/OnapCommandParameterTest.java
@@ -17,6 +17,7 @@
package org.onap.cli.fw.input;
import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertEquals;
import java.util.Arrays;
import java.util.HashMap;
@@ -48,7 +49,7 @@ public class OnapCommandParameterTest {
&& param.isOptional() && !param.isSecured()
&& param.getParameterType().equals(OnapCommandParameterType.JSON));
- assertTrue("value".equals(param.getValue()));
+ assertEquals("value", param.getValue());
param.setParameterType(OnapCommandParameterType.ARRAY);
List<String> list = Arrays.asList("1", "2", "3");
@@ -84,7 +85,7 @@ public class OnapCommandParameterTest {
String envValue = param.getEnvVarNameFromrRawDefaultValue();
- assertTrue("DAFAULT_VALUE".equals(envValue));
+ assertEquals("DAFAULT_VALUE", envValue);
}
@Test
@@ -97,7 +98,7 @@ public class OnapCommandParameterTest {
try {
param.validate();
} catch (OnapCommandException e) {
- assertTrue("0x7003::Parameter null is mandatory".equals(e.getMessage()));
+ assertEquals("0x7003::Parameter null is mandatory", e.getMessage());
}
}
@@ -107,7 +108,7 @@ public class OnapCommandParameterTest {
param.setName("name");
param.setParameterType(OnapCommandParameterType.ARRAY);
param.setValue("value");
- assertTrue("[\"1\",\"2\",\"3\"]".equals(param.getValue()));
+ assertEquals("[\"1\",\"2\",\"3\"]", param.getValue());
}
@@ -117,7 +118,7 @@ public class OnapCommandParameterTest {
param.setName("name");
param.setParameterType(OnapCommandParameterType.MAP);
param.setValue("value");
- assertTrue("{\"One\":\"1\",\"Two\":\"2\",\"Three\":\"3\"}".equals(param.getValue()));
+ assertEquals("{\"One\":\"1\",\"Two\":\"2\",\"Three\":\"3\"}", param.getValue());
}
@Test(expected = OnapCommandInvalidParameterValue.class)
diff --git a/framework/src/test/java/org/onap/cli/fw/input/ParameterTypeTest.java b/framework/src/test/java/org/onap/cli/fw/input/ParameterTypeTest.java
index a42b9120..bfe13a0b 100644
--- a/framework/src/test/java/org/onap/cli/fw/input/ParameterTypeTest.java
+++ b/framework/src/test/java/org/onap/cli/fw/input/ParameterTypeTest.java
@@ -18,6 +18,7 @@ package org.onap.cli.fw.input;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+import static org.junit.Assert.assertEquals;
import org.junit.Test;
import org.onap.cli.fw.error.OnapCommandInvalidParameterType;
@@ -44,7 +45,7 @@ public class ParameterTypeTest {
try {
OnapCommandParameterType.get("name");
} catch (OnapCommandInvalidParameterType e) {
- assertTrue("0x7001::Parameter type name is invalid".equals(e.getMessage()));
+ assertEquals("0x7001::Parameter type name is invalid", e.getMessage());
}
}
diff --git a/framework/src/test/java/org/onap/cli/fw/output/OnapCommandResultAttributeTest.java b/framework/src/test/java/org/onap/cli/fw/output/OnapCommandResultAttributeTest.java
index f2c22b21..66e151bd 100644
--- a/framework/src/test/java/org/onap/cli/fw/output/OnapCommandResultAttributeTest.java
+++ b/framework/src/test/java/org/onap/cli/fw/output/OnapCommandResultAttributeTest.java
@@ -18,6 +18,7 @@ package org.onap.cli.fw.output;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+import static org.junit.Assert.assertEquals;
import org.junit.Test;
import org.onap.cli.fw.error.OnapCommandInvalidResultAttributeScope;
@@ -36,7 +37,7 @@ public class OnapCommandResultAttributeTest {
try {
OnapCommandResultAttributeScope.get("name");
} catch (OnapCommandInvalidResultAttributeScope e) {
- assertTrue("0x8002::Result atrribute name is invalid".equals(e.getMessage()));
+ assertEquals("0x8002::Result atrribute name is invalid", e.getMessage());
}
}
diff --git a/framework/src/test/java/org/onap/cli/fw/output/OnapCommandResultTest.java b/framework/src/test/java/org/onap/cli/fw/output/OnapCommandResultTest.java
index d5d04888..83a46088 100644
--- a/framework/src/test/java/org/onap/cli/fw/output/OnapCommandResultTest.java
+++ b/framework/src/test/java/org/onap/cli/fw/output/OnapCommandResultTest.java
@@ -35,7 +35,7 @@ public class OnapCommandResultTest {
@Test
@Ignore
- public void commandResultObjTest() throws OnapCommandException {
+ public void commandResultObjTest() throws OnapCommandException { //NOSONAR
OnapCommandResult res = new OnapCommandResult();
res.setDebugInfo("debugInfo");
res.setIncludeSeparator(true);
@@ -58,7 +58,7 @@ public class OnapCommandResultTest {
@Test
@Ignore
- public void commandResultPrintLandscapeTableTest() throws OnapCommandException {
+ public void commandResultPrintLandscapeTableTest() throws OnapCommandException { //NOSONAR
OnapCommandResult res = new OnapCommandResult();
res.setDebugInfo("debugInfo");
res.setIncludeSeparator(true);
@@ -86,7 +86,7 @@ public class OnapCommandResultTest {
@Test
@Ignore
- public void commandResultPrintLandscapeJsonTest() throws OnapCommandException {
+ public void commandResultPrintLandscapeJsonTest() throws OnapCommandException { //NOSONAR
OnapCommandResult res = new OnapCommandResult();
res.setDebugInfo("debugInfo");
res.setIncludeSeparator(true);
@@ -116,7 +116,7 @@ public class OnapCommandResultTest {
@Test
@Ignore
- public void commandResultPrintLandscapeCsvTest() throws OnapCommandException {
+ public void commandResultPrintLandscapeCsvTest() throws OnapCommandException { //NOSONAR
OnapCommandResult res = new OnapCommandResult();
res.setDebugInfo("debugInfo");
res.setIncludeSeparator(true);
@@ -150,7 +150,7 @@ public class OnapCommandResultTest {
@Test
@Ignore
- public void commandResultPrintPortraitCsvTest() throws OnapCommandException {
+ public void commandResultPrintPortraitCsvTest() throws OnapCommandException { //NOSONAR
OnapCommandResult res = new OnapCommandResult();
res.setDebugInfo("debugInfo");
res.setIncludeSeparator(true);
@@ -182,7 +182,7 @@ public class OnapCommandResultTest {
@Test
@Ignore
- public void commandResultPrintPortraitTableTest() throws OnapCommandException {
+ public void commandResultPrintPortraitTableTest() throws OnapCommandException { //NOSONAR
OnapCommandResult res = new OnapCommandResult();
res.setDebugInfo("debugInfo");
res.setIncludeSeparator(true);
diff --git a/framework/src/test/java/org/onap/cli/fw/output/PrintDirectionTest.java b/framework/src/test/java/org/onap/cli/fw/output/PrintDirectionTest.java
index ae8dd2e1..2d30de91 100644
--- a/framework/src/test/java/org/onap/cli/fw/output/PrintDirectionTest.java
+++ b/framework/src/test/java/org/onap/cli/fw/output/PrintDirectionTest.java
@@ -18,6 +18,7 @@ package org.onap.cli.fw.output;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+import static org.junit.Assert.assertEquals;
import org.junit.Test;
import org.onap.cli.fw.error.OnapCommandInvalidPrintDirection;
@@ -36,7 +37,7 @@ public class PrintDirectionTest {
try {
OnapCommandPrintDirection.get("name");
} catch (OnapCommandInvalidPrintDirection e) {
- assertTrue("0x8003::Print direction name is invalid".equals(e.getMessage()));
+ assertEquals("0x8003::Print direction name is invalid", e.getMessage());
}
}
diff --git a/framework/src/test/java/org/onap/cli/fw/output/print/OnapCommandPrintTest.java b/framework/src/test/java/org/onap/cli/fw/output/print/OnapCommandPrintTest.java
index 850d31e7..ff728a33 100644
--- a/framework/src/test/java/org/onap/cli/fw/output/print/OnapCommandPrintTest.java
+++ b/framework/src/test/java/org/onap/cli/fw/output/print/OnapCommandPrintTest.java
@@ -30,7 +30,7 @@ public class OnapCommandPrintTest {
@Test
@Ignore
- public void printCsvTest() throws OnapCommandOutputPrintingFailed {
+ public void printCsvTest() throws OnapCommandOutputPrintingFailed { //NOSONAR
OnapCommandPrint pr = new OnapCommandPrint();
pr.setDirection(OnapCommandPrintDirection.LANDSCAPE);
pr.setPrintTitle(true);
diff --git a/framework/src/test/java/org/onap/cli/fw/registrar/OnapCommandRegistrarTest.java b/framework/src/test/java/org/onap/cli/fw/registrar/OnapCommandRegistrarTest.java
index 2b3c62ba..3b8876cf 100644
--- a/framework/src/test/java/org/onap/cli/fw/registrar/OnapCommandRegistrarTest.java
+++ b/framework/src/test/java/org/onap/cli/fw/registrar/OnapCommandRegistrarTest.java
@@ -105,7 +105,7 @@ public class OnapCommandRegistrarTest {
}
@OnapCommandSchema(schema = "sample-test-schema.yaml")
-final class OnapCommandTest extends OnapCommand {
+final class OnapCommandTest extends OnapCommand { //NOSONAR
public OnapCommandTest() {
diff --git a/framework/src/test/java/org/onap/cli/fw/schema/ValidateSchemaTest.java b/framework/src/test/java/org/onap/cli/fw/schema/ValidateSchemaTest.java
index e951793e..6d9b2d2c 100644
--- a/framework/src/test/java/org/onap/cli/fw/schema/ValidateSchemaTest.java
+++ b/framework/src/test/java/org/onap/cli/fw/schema/ValidateSchemaTest.java
@@ -27,6 +27,7 @@ import org.junit.Test;
import org.onap.cli.fw.cmd.OnapCommand;
import org.onap.cli.fw.error.OnapCommandException;
import org.onap.cli.fw.error.OnapCommandInvalidSchema;
+import static org.junit.Assert.assertEquals;
public class ValidateSchemaTest {
@@ -123,7 +124,7 @@ public class ValidateSchemaTest {
protected void run() throws OnapCommandException {}
};
List<String> errorList5 = OnapCommandSchemaLoader.loadSchema(cmd5, "schema-validate-pass.yaml", true, true);
- assertTrue(errorList5.size() == 0);
+ assertEquals(0, errorList5.size());
}
diff --git a/framework/src/test/java/org/onap/cli/fw/utils/OnapCommandUtilsTest.java b/framework/src/test/java/org/onap/cli/fw/utils/OnapCommandUtilsTest.java
index d7bd8051..44c18194 100644
--- a/framework/src/test/java/org/onap/cli/fw/utils/OnapCommandUtilsTest.java
+++ b/framework/src/test/java/org/onap/cli/fw/utils/OnapCommandUtilsTest.java
@@ -263,7 +263,7 @@ public class OnapCommandUtilsTest {
@Test
@Ignore
- public void invalidSchemaFileTest() throws OnapCommandException {
+ public void invalidSchemaFileTest() throws OnapCommandException { //NOSONAR
Map<String, ?> map = null;
try {
map = OnapCommandSchemaLoader.validateSchemaVersion("sample-test-schema1.yaml", "1.0");
@@ -371,7 +371,7 @@ public class OnapCommandUtilsTest {
}
Map<String, OnapCommandParameter> map = OnapCommandUtils.getInputMap(cmd.getParameters());
- assertTrue(map.size() == 18);
+ assertEquals(18, map.size());
}
@Test
@@ -554,6 +554,6 @@ public class OnapCommandUtilsTest {
public void loadYamlTest() throws OnapCommandInvalidSchema {
File file=new File("src/test/resources/sample-test-info.yaml");
Map<String, Object> values= OnapCommandDiscoveryUtils.loadYaml(file.getAbsolutePath());
- assertEquals(values.get("name"),"sample-test-info");
+ assertEquals("sample-test-info",values.get("name"));
}
}