HistoryCommand extends AbstractCommand { public static HistoryCommand parse(String cmd, ExecutionContext cxt) { if (cmd == null || cxt == null || ODPSConsoleUtils.isWindows()) { return null; } if ("history".equalsIgnoreCase(cmd.trim())) { return new HistoryCommand(cmd.trim(), cxt); } return null; } HistoryCommand(String commandText, ExecutionContext context); static void printUsage(PrintStream stream); void run(); static HistoryCommand parse(String cmd, ExecutionContext cxt); static final String[] HELP_TAGS; }
@Test public void test() throws Exception { HistoryCommand historyCommand = null; ExecutionContext context = ExecutionContext.init(); for (String cmd : positive) { historyCommand = HistoryCommand.parse(cmd, context); assertNotNull(historyCommand); } for (String cmd : negative) { historyCommand = HistoryCommand.parse(cmd, context); assertNull(historyCommand); } }