### Question:
RespondingCommand implements Command { @Override public void execute(CommandExecution execution) { sendMessage.to(execution.getSender().getId(), commandFunction.execute(execution)); }  @Override void execute(CommandExecution execution);  }### Answer:
@Test public void execute() { CommandFunction commandFunction = mock(CommandFunction.class); SendMessage sendMessage = mock(SendMessage.class); Message response = mock(Message.class); when(commandFunction.execute(any())).thenReturn(response); RespondingCommand respondingCommand = new RespondingCommand( sendMessage, commandFunction ); CommandExecution commandExecution = mock(CommandExecution.class); when(commandExecution.getSender()).thenReturn(mock(Sender.class)); respondingCommand.execute(commandExecution); verify(sendMessage).to(any(), same(response)); }