@Test public void kick() { PlayerRepository repository = mock(PlayerRepository.class); MessagingService messagingService = mock(MessagingService.class); ProxyKick proxyKick = new ProxyKick( repository, messagingService ); when(repository.getPlayerProxy(eq("riguron"))) .thenReturn(Optional.of("proxy")); assertTrue(proxyKick.kick("riguron", "reason for kick")); verify(messagingService).send(eq(new KickProxyCommand("riguron", "reason for kick")) , eq("proxy")); }
public boolean kick(String target, String reason) { return playerRepository.getPlayerProxy(target) .map(proxyName -> { messagingService.send(new KickProxyCommand(target, reason), proxyName); return Boolean.TRUE; }).orElse(Boolean.FALSE); }
ProxyKick { public boolean kick(String target, String reason) { return playerRepository.getPlayerProxy(target) .map(proxyName -> { messagingService.send(new KickProxyCommand(target, reason), proxyName); return Boolean.TRUE; }).orElse(Boolean.FALSE); } }
ProxyKick { public boolean kick(String target, String reason) { return playerRepository.getPlayerProxy(target) .map(proxyName -> { messagingService.send(new KickProxyCommand(target, reason), proxyName); return Boolean.TRUE; }).orElse(Boolean.FALSE); }  }
ProxyKick { public boolean kick(String target, String reason) { return playerRepository.getPlayerProxy(target) .map(proxyName -> { messagingService.send(new KickProxyCommand(target, reason), proxyName); return Boolean.TRUE; }).orElse(Boolean.FALSE); }  boolean kick(String target, String reason); }
ProxyKick { public boolean kick(String target, String reason) { return playerRepository.getPlayerProxy(target) .map(proxyName -> { messagingService.send(new KickProxyCommand(target, reason), proxyName); return Boolean.TRUE; }).orElse(Boolean.FALSE); }  boolean kick(String target, String reason);  }