@Test public void getCommand() { repository = new VirtualCommandRepository(); Command command = mock(Command.class); CommandOptions options = mock(CommandOptions.class); CommandRegistration commandRegistration = new CommandRegistration( command, options ); when(options.getAliases()).thenReturn(Arrays.asList("a", "b", "c")); when(options.getBody()).thenReturn("body"); repository.addCommand(commandRegistration); assertExists("a"); assertExists("b"); assertExists("c"); assertExists("body"); }
@Override public Optional<CommandRegistration> getCommand(String body) { return Optional.ofNullable(commands.get(body)); }
VirtualCommandRepository implements CommandRepository { @Override public Optional<CommandRegistration> getCommand(String body) { return Optional.ofNullable(commands.get(body)); } }
VirtualCommandRepository implements CommandRepository { @Override public Optional<CommandRegistration> getCommand(String body) { return Optional.ofNullable(commands.get(body)); }  }
VirtualCommandRepository implements CommandRepository { @Override public Optional<CommandRegistration> getCommand(String body) { return Optional.ofNullable(commands.get(body)); }  @Override Optional<CommandRegistration> getCommand(String body); @Override void addCommand(CommandRegistration commandRegistration); }
VirtualCommandRepository implements CommandRepository { @Override public Optional<CommandRegistration> getCommand(String body) { return Optional.ofNullable(commands.get(body)); }  @Override Optional<CommandRegistration> getCommand(String body); @Override void addCommand(CommandRegistration commandRegistration);  }