diff options
Diffstat (limited to 'profiles/http/src')
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) |