LeagueDetails { public LeagueRound executeRound(LeagueRound round) { List<Match> matchesWithResult = FluentIterable.from(round.matches()) .transform(m -> Match.create(m.id(), m.home(), m.away(), resultFor(m))) .toList(); return LeagueRound.create(round.id(), round.roundNumber(), matchesWithResult); } LeagueDetails(ElifutDataStore persistenceService, ClubDataStore clubDataStore,
      LeagueRoundGenerator leagueRoundGenerator, MatchResultGenerator generator); void initialize(List<? extends Club> allClubs); LeagueRound nextRound(); boolean haveRoundsLeft(); int clubPosition(Club club); LeagueRound executeRound(LeagueRound round); Observable<? extends List<? extends Club>> clubsObservable(); Observable<? extends List<? extends LeagueRound>> roundsObservable(); List<? extends Club> clubs(); List<? extends LeagueRound> rounds();  }
@Test public void testExecuteRound() { Club gremio = TestFixtures.GREMIO; Club internacional = TestFixtures.INTERNACIONAL; MatchResultGenerator mockResultGenerator = mock(MatchResultGenerator.class); MatchResult fakeResult = MatchResult.builder() .homeGoals(Collections.singletonList(newGoal(10, gremio))) .awayGoals(emptyList()) .build(gremio, internacional); when(clubDataStore.squad(any())).thenReturn(ClubSquad.create(0, emptyList())); ClubSquad homeSquad = ClubSquad.create(0, emptyList()); ClubSquad awaySquad = ClubSquad.create(0, emptyList()); when(mockResultGenerator.generate(gremio, homeSquad, internacional, awaySquad)) .thenReturn(fakeResult); LeagueDetails leagueDetails = new LeagueDetails( persistenceService, clubDataStore, roundGenerator, mockResultGenerator); Match match = Match.create(gremio, internacional); LeagueRound round = LeagueRound.create(1, Collections.singletonList(match)); LeagueRound leagueRound = leagueDetails.executeRound(round); verify(mockResultGenerator).generate(gremio, homeSquad, internacional, awaySquad); assertThat(leagueRound.matches().get(0).result()).isEqualTo(fakeResult); }