use of io.airlift.airline.ParseArgumentsUnexpectedException in project activemq-artemis by apache.
the class OptionsValidationTest method testCommand.
@Test
public void testCommand() throws Exception {
ActionContext context = new TestActionContext();
String[] invalidArgs = null;
if (group == null) {
invalidArgs = new String[] { command, "--blahblah-" + command, "--rubbish-" + command + "=" + "more-rubbish", "--input=blahblah" };
} else {
invalidArgs = new String[] { group, command, "--blahblah-" + command, "--rubbish-" + command + "=" + "more-rubbish", "--input=blahblah" };
}
try {
Artemis.internalExecute(null, needInstance ? this.artemisInstance : null, invalidArgs, context);
fail("cannot detect invalid options");
} catch (InvalidOptionsError e) {
assertTrue(e.getMessage().contains("Found unexpected parameters"));
} catch (ParseArgumentsUnexpectedException e) {
// airline can detect some invalid args during parsing
// which is fine.
}
}
Aggregations