context.set("SCOPE", "*");
context.set(SessionProperties.COMPLETION_MODE, "subshell");
CommandSessionHolder.setSession(context.getSession());
context.addCommand("*", new SimpleSubShell("foo"), "foo");
context.addCommand("*", new SimpleCommand(ExitAction.class), "exit");
context.addCommand("foo", new SimpleCommand(MyAction.class), "my-action");
context.addCommand("foo", new SimpleCommand(MyActionTwoArguments.class), "one-action");
context.addCommand("bar", new SimpleCommand(MyAction.class), "one-action");
context.addCommand("bar", new SimpleCommand(MyActionTwoArguments.class), "another");
Completer comp = new CommandsCompleter(context.getSession());
context.execute("foo");
assertEquals(Arrays.asList("my-action "), complete(comp, "my"));