### Question:
VirtualCommandRepository implements CommandRepository { @Override public void addCommand(CommandRegistration commandRegistration) { CommandOptions commandOptions = commandRegistration.getCommandOptions(); this.putCommand(commandOptions.getBody(), commandRegistration); commandOptions.getAliases().forEach(aliasName -> this.putCommand(aliasName, commandRegistration)); }  @Override Optional<CommandRegistration> getCommand(String body); @Override void addCommand(CommandRegistration commandRegistration);  }### Answer:
@Test(expected = IllegalArgumentException.class) public void whenOverwriteThenExceptionFired() { repository = new VirtualCommandRepository(); CommandOptions options = mock(CommandOptions.class); CommandRegistration commandRegistration = new CommandRegistration( mock(Command.class), options ); when(options.getBody()).thenReturn("body"); repository.addCommand(commandRegistration); repository.addCommand(commandRegistration); }