@Test public void throwIfNotEnoughGoalkeepers() { try { List<Player> players = Arrays.asList(buildPlayer("LB"), buildPlayer("CB"), buildPlayer("CB"), buildPlayer("RB"), buildPlayer("LM"), buildPlayer("CM"), buildPlayer("CM"), buildPlayer("CAM"), buildPlayer("RM"), buildPlayer("ST"), buildPlayer("CF")); ClubSquadBuilder builder = new ClubSquadBuilder(TestFixtures.GREMIO, players); 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();  }