diff --git a/src/Tools/vmOpsTool/VmOpsTool.java b/src/Tools/vmOpsTool/VmOpsTool.java index 306956a..e0d2bed 100644 --- a/src/Tools/vmOpsTool/VmOpsTool.java +++ b/src/Tools/vmOpsTool/VmOpsTool.java @@ -100,7 +100,7 @@ public class VmOpsTool { System.out.println("Parsing input parameters..."); for (String arg : cmdArgs) { - if (arg.charAt(0) == '-') { + if (!arg.equals("") && arg.charAt(0) == '-') { key = arg; } else if (!arg.equals(Constants.vmOpsTool)){ value = arg; diff --git a/tests/Tools/vmOpsTool/VmOpsToolUnitTests.java b/tests/Tools/vmOpsTool/VmOpsToolUnitTests.java index 96a3372..7662bc0 100644 --- a/tests/Tools/vmOpsTool/VmOpsToolUnitTests.java +++ b/tests/Tools/vmOpsTool/VmOpsToolUnitTests.java @@ -30,6 +30,18 @@ public class VmOpsToolUnitTests { assertThat(argsMap.get(Constants.vCenterUrl)).isEqualTo(vCenterUrl); } + @Test + public void parseCmdArgsWithEmptyDescription() { + String[] cmdArgs = { Constants.vmOpsTool, Constants.description, "" }; + + Map argsMap = VmOpsTool.parseCmdLine(cmdArgs); + + assertThat(argsMap.size()).isEqualTo(1); + assertThat(argsMap.containsKey(Constants.vmOpsTool)).isEqualTo(false); + assertThat(argsMap.containsKey(Constants.description)).isEqualTo(true); + assertThat(argsMap.get(Constants.description)).isEqualTo(""); + } + @Test public void executeActionShouldSucceedForCreateAndDeleteSnapshotOperation() throws Exception { // Create snapshot operation validation