@Test public void whenTeleportAllPlayersThenTeleported() { runAssertions((teams, teamGameMap) -> { List<TeamPlayer> allPlayers = new ArrayList<>(); for (int i = 0; i < 20; i++) { TeamPlayer teamPlayer = mock(TeamPlayer.class); when(teamPlayer.getTeam()).thenReturn(teams.get(i % teams.size())); allPlayers.add(teamPlayer); } when(playerStorage.getAllPlayers()).thenReturn(allPlayers); teamGameMap.teleportPlayers(); for (TeamPlayer allPlayer : allPlayers) { verify(allPlayer).teleport(argThat( location -> configuredTeamLocations .get(allPlayer.getTeam()).contains(location))); } }); }
@Override public void teleportPlayers() { teamPlayerRepository .getAllPlayers() .forEach(teamPlayer -> teamPlayer.teleport( this.validLocationIterator(teamPlayer).next())); }
TeamGameMap extends AbstractGameMap { @Override public void teleportPlayers() { teamPlayerRepository .getAllPlayers() .forEach(teamPlayer -> teamPlayer.teleport( this.validLocationIterator(teamPlayer).next())); } }
TeamGameMap extends AbstractGameMap { @Override public void teleportPlayers() { teamPlayerRepository .getAllPlayers() .forEach(teamPlayer -> teamPlayer.teleport( this.validLocationIterator(teamPlayer).next())); } TeamGameMap(String name, GamePlayerStorage<TeamPlayer> teamPlayerRepository, Map<Team, List<Location>> configuredTeamLocations); }
TeamGameMap extends AbstractGameMap { @Override public void teleportPlayers() { teamPlayerRepository .getAllPlayers() .forEach(teamPlayer -> teamPlayer.teleport( this.validLocationIterator(teamPlayer).next())); } TeamGameMap(String name, GamePlayerStorage<TeamPlayer> teamPlayerRepository, Map<Team, List<Location>> configuredTeamLocations); @Override void teleportPlayers(); @Override void teleportPlayer(UUID playerId); }
TeamGameMap extends AbstractGameMap { @Override public void teleportPlayers() { teamPlayerRepository .getAllPlayers() .forEach(teamPlayer -> teamPlayer.teleport( this.validLocationIterator(teamPlayer).next())); } TeamGameMap(String name, GamePlayerStorage<TeamPlayer> teamPlayerRepository, Map<Team, List<Location>> configuredTeamLocations); @Override void teleportPlayers(); @Override void teleportPlayer(UUID playerId);  }