### Question:
UnregisterAdminCommand implements ExecutableCommand { @Override public void executeCommand(final CommandSender sender, List<String> arguments) { String playerName = arguments.get(0); if (!dataSource.isAuthAvailable(playerName)) { commonService.send(sender, MessageKey.UNKNOWN_USER); return; } Player target = bukkitService.getPlayerExact(playerName); management.performUnregisterByAdmin(sender, playerName, target); } UnregisterAdminCommand(); @Override void executeCommand(final CommandSender sender, List<String> arguments);  }### Answer:
@Test public void shouldHandleUnknownPlayer() { String user = "bobby"; given(dataSource.isAuthAvailable(user)).willReturn(false); CommandSender sender = mock(CommandSender.class); command.executeCommand(sender, Collections.singletonList(user)); verify(dataSource, only()).isAuthAvailable(user); verify(commandService).send(sender, MessageKey.UNKNOWN_USER); }
@Test public void shouldInvokeUnregisterProcess() { String user = "personaNonGrata"; given(dataSource.isAuthAvailable(user)).willReturn(true); Player player = mock(Player.class); given(bukkitService.getPlayerExact(user)).willReturn(player); CommandSender sender = mock(CommandSender.class); command.executeCommand(sender, Collections.singletonList(user)); verify(dataSource, only()).isAuthAvailable(user); verify(bukkitService).getPlayerExact(user); verify(management).performUnregisterByAdmin(sender, user, player); }
@Test public void shouldInvokeUnregisterProcessWithNullPlayer() { String user = "personaNonGrata"; given(dataSource.isAuthAvailable(user)).willReturn(true); given(bukkitService.getPlayerExact(user)).willReturn(null); CommandSender sender = mock(CommandSender.class); command.executeCommand(sender, Collections.singletonList(user)); verify(dataSource, only()).isAuthAvailable(user); verify(bukkitService).getPlayerExact(user); verify(management).performUnregisterByAdmin(sender, user, null); }