### Question:
TeamAssigner { public void assignRemaining() { gamePlayerStorage.getAllPlayers().forEach(teamPlayer -> { if (!teamPlayer.isInTeam()) { teams.getMostFreeTeam().getPlayers().add(teamPlayer); } }); }  void assignRemaining();  }### Answer:
@Test public void assignTeams() { GamePlayerStorage<TeamPlayer> storage = mock(GamePlayerStorage.class); Teams teams = mock(Teams.class); when(storage.getAllPlayers()).thenReturn(players); TeamAssigner teamAssigner = new TeamAssigner(storage, teams); TeamPlayers teamPlayers = mock(TeamPlayers.class); Team mostFree = mock(Team.class); when(teams.getMostFreeTeam()).thenReturn(mostFree); when(mostFree.getPlayers()).thenReturn(teamPlayers); addPlayer(true); addPlayer(false); addPlayer(false); addPlayer(true); teamAssigner.assignRemaining(); verify(teamPlayers, times(0)).add(eq(players.get(0))); verify(teamPlayers, times(1)).add(eq(players.get(1))); verify(teamPlayers, times(1)).add(eq(players.get(2))); verify(teamPlayers, times(0)).add(eq(players.get(3))); }