summaryrefslogtreecommitdiffstats
path: root/profiles
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 /profiles
parent5f23e02caa5ab128a4c01866dec91eaea8dc7cee (diff)
Code Improvements
Signed-off-by: SravanKumarGunda <sravan.kumar1@huawei.com> Issue-ID: CLI-270 Change-Id: I3de621dab68f153c16a36102239b095c60abf9ab
Diffstat (limited to 'profiles')
-rw-r--r--profiles/http/src/main/java/org/onap/cli/fw/http/cmd/OnapHttpCommand.java4
-rw-r--r--profiles/http/src/test/java/org/onap/cli/fw/http/HttpInputOutputTest.java7
-rw-r--r--profiles/http/src/test/java/org/onap/cli/fw/http/utils/OnapCommandUtilsTest.java9
3 files changed, 11 insertions, 9 deletions
diff --git a/profiles/http/src/main/java/org/onap/cli/fw/http/cmd/OnapHttpCommand.java b/profiles/http/src/main/java/org/onap/cli/fw/http/cmd/OnapHttpCommand.java
index 387ec3be..e17f8615 100644
--- a/profiles/http/src/main/java/org/onap/cli/fw/http/cmd/OnapHttpCommand.java
+++ b/profiles/http/src/main/java/org/onap/cli/fw/http/cmd/OnapHttpCommand.java
@@ -183,8 +183,8 @@ public class OnapHttpCommand extends OnapCommand {
OnapCommandParameter context = contextOpt.get();
Map<String, String> map = (Map<String, String>) context.getValue();
- mockingEnabled = map.containsKey(OnapCommandHttpConstants.VERIFY_DISABLE_MOCKING)
- && "true".equals(map.get(OnapCommandHttpConstants.VERIFY_DISABLE_MOCKING)) ? false : true;
+ mockingEnabled = !(map.containsKey(OnapCommandHttpConstants.VERIFY_DISABLE_MOCKING)
+ && "true".equals(map.get(OnapCommandHttpConstants.VERIFY_DISABLE_MOCKING)));
if (mockingEnabled) {
String mockedFile = ((Map<String, String>) context.getValue()).get(OnapCommandConstants.VERIFY_MOCO);
diff --git a/profiles/http/src/test/java/org/onap/cli/fw/http/HttpInputOutputTest.java b/profiles/http/src/test/java/org/onap/cli/fw/http/HttpInputOutputTest.java
index 597a3280..28439aaf 100644
--- a/profiles/http/src/test/java/org/onap/cli/fw/http/HttpInputOutputTest.java
+++ b/profiles/http/src/test/java/org/onap/cli/fw/http/HttpInputOutputTest.java
@@ -23,6 +23,7 @@ import java.util.HashMap;
import org.junit.Test;
import org.onap.cli.fw.http.connect.HttpInput;
import org.onap.cli.fw.http.connect.HttpResult;
+import static org.junit.Assert.assertEquals;
public class HttpInputOutputTest {
@@ -45,7 +46,7 @@ public class HttpInputOutputTest {
String msg = "\nURL: uri\nMethod: method\nRequest Queries: {}\nRequest Body: body\nRequest Headers: "
+ "{}\nRequest Cookies: {}\nbinaryData=false\nContext={}";
- assertTrue(msg.equals(inp.toString()));
+ assertEquals(msg, inp.toString());
}
@Test
@@ -62,8 +63,8 @@ public class HttpInputOutputTest {
out.setRespCookies(new HashMap<String, String>());
out.setRespHeaders(new HashMap<String, String>());
out.setStatus(200);
- assertTrue("\nHTTP Status: 200\nResponse Body: body\nResponse Headers: {}\nResponse Cookies: {}"
- .equals(out.toString()));
+ assertEquals("\nHTTP Status: 200\nResponse Body: body\nResponse Headers: {}\nResponse Cookies: {}"
+ , out.toString());
}
}
diff --git a/profiles/http/src/test/java/org/onap/cli/fw/http/utils/OnapCommandUtilsTest.java b/profiles/http/src/test/java/org/onap/cli/fw/http/utils/OnapCommandUtilsTest.java
index 6807321e..7ad3c3ff 100644
--- a/profiles/http/src/test/java/org/onap/cli/fw/http/utils/OnapCommandUtilsTest.java
+++ b/profiles/http/src/test/java/org/onap/cli/fw/http/utils/OnapCommandUtilsTest.java
@@ -55,6 +55,7 @@ import org.onap.cli.fw.error.OnapCommandResultEmpty;
import static org.junit.Assert.assertFalse;
import org.onap.cli.fw.http.connect.HttpInput;
import org.onap.cli.fw.http.connect.HttpInput.Part;
+import static org.junit.Assert.assertNotNull;
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class OnapCommandUtilsTest {
@@ -67,7 +68,7 @@ public class OnapCommandUtilsTest {
@Test
public void oclipCommandUtilsInputStreamNotNullTest() throws OnapCommandException {
Map<String, ?> map = OnapCommandSchemaLoader.validateSchemaVersion("sample-test1-schema-http.yaml", "1.0");
- assertTrue(map != null);
+ assertNotNull(map);
}
@Test
@@ -76,7 +77,7 @@ public class OnapCommandUtilsTest {
cmd.setName("sample-create-http");
try {
OnapCommandSchemaHttpLoader.loadHttpSchema(cmd, "sample-test-schema-http.yaml", true, true);
- assertTrue(cmd.getSuccessStatusCodes().size() == 2);
+ assertEquals(2, cmd.getSuccessStatusCodes().size());
} catch (OnapCommandParameterNameConflict | OnapCommandParameterOptionConflict
| OnapCommandInvalidParameterType | OnapCommandInvalidPrintDirection
| OnapCommandInvalidResultAttributeScope | OnapCommandSchemaNotFound | OnapCommandInvalidSchema
@@ -97,10 +98,10 @@ public class OnapCommandUtilsTest {
}
};
OnapCommandSchemaLoader.loadSchema(cmd, "sample-test-schema-auth-required.yaml", true, false);
- assertTrue("sample-test".equals(cmd.getName()));
+ assertEquals("sample-test", cmd.getName());
Map<String, OnapCommandParameter> map = OnapCommandUtils.getInputMap(cmd.getParameters());
- assertTrue(map.size() == 9);
+ assertEquals(9, map.size());
}
@Test(expected = OnapCommandHttpHeaderNotFound.class)