@Test public void noAttackersButExtraDefenderAndGoalkeeper() { Player[] players = new Player[] { buildPlayer("LB"), buildPlayer("CB"), buildPlayer("CB"), buildPlayer("CB"), buildPlayer("RB"), buildPlayer("LM"), buildPlayer("CM"), buildPlayer("GK"), buildPlayer("GK"), buildPlayer("CAM"), buildPlayer("CDM") }; ClubSquadBuilder builder = new ClubSquadBuilder(TestFixtures.GREMIO, Arrays.asList(players)); ClubSquad clubSquad = builder.build(); assertThat(clubSquad.players()).containsExactly(buildPlayer("GK"), buildPlayer("LB"), buildPlayer("CB"), buildPlayer("CB"), buildPlayer("CB"), buildPlayer("LM"), buildPlayer("CM"), buildPlayer("CAM"), buildPlayer("CDM"), buildPlayer("RB"), buildPlayer("GK")); }
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();  }