diff options
Diffstat (limited to 'qpid/java/broker/src/test/java/org/apache/qpid/server/MainTest.java')
-rw-r--r-- | qpid/java/broker/src/test/java/org/apache/qpid/server/MainTest.java | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/qpid/java/broker/src/test/java/org/apache/qpid/server/MainTest.java b/qpid/java/broker/src/test/java/org/apache/qpid/server/MainTest.java index 3e4c30291c..31d5028536 100644 --- a/qpid/java/broker/src/test/java/org/apache/qpid/server/MainTest.java +++ b/qpid/java/broker/src/test/java/org/apache/qpid/server/MainTest.java @@ -20,10 +20,11 @@ */ package org.apache.qpid.server; -import java.util.EnumSet; - +import org.apache.commons.cli.CommandLine; import org.apache.qpid.test.utils.QpidTestCase; +import java.util.EnumSet; + /** * Test to verify the command line parsing within the Main class, by * providing it a series of command line arguments and verifying the @@ -145,6 +146,22 @@ public class MainTest extends QpidTestCase assertEquals(9, options.getLogWatchFrequency()); } + public void testVersion() + { + final TestMain main = new TestMain("-v".split("\\s")); + + assertNotNull("Command line not parsed correctly", main.getCommandLine()); + assertTrue("Parsed command line didnt pick up version option", main.getCommandLine().hasOption("v")); + } + + public void testHelp() + { + final TestMain main = new TestMain("-h".split("\\s")); + + assertNotNull("Command line not parsed correctly", main.getCommandLine()); + assertTrue("Parsed command line didnt pick up help option", main.getCommandLine().hasOption("h")); + } + private BrokerOptions startDummyMain(String commandLine) { return (new TestMain(commandLine.split("\\s"))).getOptions(); @@ -174,5 +191,10 @@ public class MainTest extends QpidTestCase { return _options; } + + public CommandLine getCommandLine() + { + return _commandLine; + } } } |