ListResourcesCommand extends AbstractCommand { public static ListResourcesCommand parse(String commandString, ExecutionContext sessionContext) throws ODPSConsoleException { Matcher match = PATTERN.matcher(commandString); if (match.matches()) { Options opts = initOptions(); CommandLine cl = CommandParserUtils.getCommandLine(commandString, opts); return new ListResourcesCommand(commandString, sessionContext, cl.getOptionValue("p"), cl.hasOption("l")); } return null; } ListResourcesCommand(String commandText, ExecutionContext context, String project,
                              boolean showAll); static void printUsage(PrintStream out); void run(); static ListResourcesCommand parse(String commandString, ExecutionContext sessionContext); static final String[] HELP_TAGS; }
@Test public void testMatchNegative() throws OdpsException, ODPSConsoleException { ExecutionContext ctx = ExecutionContext.init(); ListResourcesCommand test; for (String cmd : negatives) { Assert.assertNull(ListResourcesCommand.parse(cmd, ctx)); } }
@Test(expected = ODPSConsoleException.class) public void testLackParas() throws ODPSConsoleException { ExecutionContext context = ExecutionContext.init(); for (String cmd : badPara) { ListResourcesCommand.parse(cmd, context); } }