UserInputEvaluation implements CommandRegistry { public void evaluate(String userInput) { CommandLineArguments arguments = new CommandLineArguments(userInput); if (!arguments.asScanner().hasNext()) { return; } try { handleCommand(arguments); } catch (Exception ex) { handleException(ex); } } UserInputEvaluation(); void setProvisioning(Provisioning provisioning); String[] commands(); @Override void registerCommand(Command command); @Override void unregisterCommand(Command command); @Override Command getCommand(String commandName); void evaluate(String userInput);  }
@Test public void stateCommand() { userInputEvaluation.evaluate("state"); assertThat(commandLineEvaluation.getLastCommand(), is("state")); assertThat(commandLineEvaluation.getLastArguments().asScanner().hasNext(), is(false)); }
@Test public void shutdownCommand() { userInputEvaluation.evaluate("shutdown"); assertThat(commandLineEvaluation.getLastCommand(), is("shutdown")); assertThat(commandLineEvaluation.getLastArguments().asScanner().hasNext(), is(false)); }