@Test public void throwIfNotEnoughPlayers() { try { ClubSquadBuilder builder = new ClubSquadBuilder(TestFixtures.GREMIO, Collections.emptyList()); builder.build(); fail(); } catch (IllegalArgumentException ignored) { } }
public ClubSquad build() { squad.add(goalkeepers.remove(0)); addToSquad(ClubSquad.TOTAL_DEFENDERS, asList(defenders, midfielders, attackers, goalkeepers)); addToSquad(ClubSquad.TOTAL_MIDFIELDERS, asList(midfielders, attackers, defenders, goalkeepers)); addToSquad(ClubSquad.TOTAL_ATTACKERS, asList(attackers, midfielders, defenders, goalkeepers)); return ClubSquad.create(club.id(), squad); }
ClubSquadBuilder { public ClubSquad build() { squad.add(goalkeepers.remove(0)); addToSquad(ClubSquad.TOTAL_DEFENDERS, asList(defenders, midfielders, attackers, goalkeepers)); addToSquad(ClubSquad.TOTAL_MIDFIELDERS, asList(midfielders, attackers, defenders, goalkeepers)); addToSquad(ClubSquad.TOTAL_ATTACKERS, asList(attackers, midfielders, defenders, goalkeepers)); return ClubSquad.create(club.id(), squad); } }
ClubSquadBuilder { public ClubSquad build() { squad.add(goalkeepers.remove(0)); addToSquad(ClubSquad.TOTAL_DEFENDERS, asList(defenders, midfielders, attackers, goalkeepers)); addToSquad(ClubSquad.TOTAL_MIDFIELDERS, asList(midfielders, attackers, defenders, goalkeepers)); addToSquad(ClubSquad.TOTAL_ATTACKERS, asList(attackers, midfielders, defenders, goalkeepers)); return ClubSquad.create(club.id(), squad); } ClubSquadBuilder(Club club, List<Player> allPlayers); }
ClubSquadBuilder { public ClubSquad build() { squad.add(goalkeepers.remove(0)); addToSquad(ClubSquad.TOTAL_DEFENDERS, asList(defenders, midfielders, attackers, goalkeepers)); addToSquad(ClubSquad.TOTAL_MIDFIELDERS, asList(midfielders, attackers, defenders, goalkeepers)); addToSquad(ClubSquad.TOTAL_ATTACKERS, asList(attackers, midfielders, defenders, goalkeepers)); return ClubSquad.create(club.id(), squad); } ClubSquadBuilder(Club club, List<Player> allPlayers); ClubSquad build(); }
ClubSquadBuilder { public ClubSquad build() { squad.add(goalkeepers.remove(0)); addToSquad(ClubSquad.TOTAL_DEFENDERS, asList(defenders, midfielders, attackers, goalkeepers)); addToSquad(ClubSquad.TOTAL_MIDFIELDERS, asList(midfielders, attackers, defenders, goalkeepers)); addToSquad(ClubSquad.TOTAL_ATTACKERS, asList(attackers, midfielders, defenders, goalkeepers)); return ClubSquad.create(club.id(), squad); } ClubSquadBuilder(Club club, List<Player> allPlayers); ClubSquad build();  }