UserInputEvaluation implements CommandRegistry { @Override public void unregisterCommand(Command command) { commands.remove(command.getCommandName()); } 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 unregisterCommand() { userInputEvaluation.registerCommand(new CommandImpl("mycommand", null, "")); int numberOfCommands = userInputEvaluation.commands().length; userInputEvaluation.unregisterCommand(new CommandImpl("mycommand", null, "")); assertThat(userInputEvaluation.commands(), not(hasItemInArray("mycommand"))); assertThat(userInputEvaluation.commands().length, is(numberOfCommands-1)); }