Club extends Model implements Persistable { public List<? extends Player> substitutes(ClubDataStore dataStore) { List<? extends Player> players = dataStore.allPlayers(this); ClubSquad clubSquad = dataStore.squad(this); return FluentIterable.from(players) .filter(not(in(clubSquad.players()))) .toList(); }  abstract String name(); abstract String small_image(); abstract String large_image(); abstract int league_id(); @Nullable abstract String abbrev_name(); @ColumnAdapter(ClubStats.Adapter.class) @Nullable abstract ClubStats stats(); static Club create(Cursor cursor); abstract ContentValues toContentValues(); @Override String toString(); List<? extends Player> substitutes(ClubDataStore dataStore); void replacePlayer(Player oldPlayer, Player newPlayer, ClubDataStore dataStore); static Builder builder(); static Club create(int id, String name); String tinyName(); abstract Builder toBuilder(); Club newWithWin(int goalsDifferential); boolean nameEquals(Club otherTeam); Club newWithDraw(); Club newWithLoss(int goalsDifferential); @NonNull ClubStats nonNullStats(); String shortName(); static JsonAdapter<Club> jsonAdapter(Moshi moshi); @Override int describeContents();  }
@Test public void testSubstitutes() { Club club = Club.builder().id(0).name("Sample").build(); service.create(club); Player gornaldo = TestFixtures.GORNALDO.toBuilder().clubId(0).build(); Player pele = TestFixtures.PELE.toBuilder().clubId(0).build(); List<Player> players = Arrays.asList(gornaldo, pele); ClubSquad clubSquad = ClubSquad.create(0, Collections.singletonList(gornaldo)); service.create(players); service.create(clubSquad); List<? extends Player> substitutes = club.substitutes(clubDataStore); assertThat(substitutes).isEqualTo(Collections.singletonList(pele)); }