diff options
author | SravanKumarGunda <sravan.kumar1@huawei.com> | 2020-07-14 14:55:47 +0530 |
---|---|---|
committer | SravanKumarGunda <sravan.kumar1@huawei.com> | 2020-07-14 19:22:59 +0530 |
commit | 9a08d687e48312beef47bce357d374ede2ce0dc7 (patch) | |
tree | 3717d377dd4ea90f4e88c28d52bb3c0d5d28f34c /profiles/http/src/test | |
parent | 5f23e02caa5ab128a4c01866dec91eaea8dc7cee (diff) |
Code Improvements
Signed-off-by: SravanKumarGunda <sravan.kumar1@huawei.com>
Issue-ID: CLI-270
Change-Id: I3de621dab68f153c16a36102239b095c60abf9ab
Diffstat (limited to 'profiles/http/src/test')
-rw-r--r-- | profiles/http/src/test/java/org/onap/cli/fw/http/HttpInputOutputTest.java | 7 | ||||
-rw-r--r-- | profiles/http/src/test/java/org/onap/cli/fw/http/utils/OnapCommandUtilsTest.java | 9 |
2 files changed, 9 insertions, 7 deletions
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) |