@Test public void getPlaces() { when(storage.getAllPlayers()).thenAnswer(x -> getPlayers()); OrderedResultCalculation orderedResultCalculation = new OrderedResultCalculation( storage, new PlaceOrderByScore() ); List<Place> places = orderedResultCalculation.getPlaces(); assertEquals(7, places.size()); assertPlace(places, 0, 61); assertPlace(places, 1, 11); assertPlace(places, 2, 9); }
@Override public List<Place> getPlaces() { List<GamePlayer> allPlayers = sort(); return IntStream.range(0, allPlayers.size()) .mapToObj(value -> new Place(value + 1, allPlayers.get(value))) .collect(Collectors.toList()); }
OrderedResultCalculation implements SoloResultCalculation { @Override public List<Place> getPlaces() { List<GamePlayer> allPlayers = sort(); return IntStream.range(0, allPlayers.size()) .mapToObj(value -> new Place(value + 1, allPlayers.get(value))) .collect(Collectors.toList()); } }
OrderedResultCalculation implements SoloResultCalculation { @Override public List<Place> getPlaces() { List<GamePlayer> allPlayers = sort(); return IntStream.range(0, allPlayers.size()) .mapToObj(value -> new Place(value + 1, allPlayers.get(value))) .collect(Collectors.toList()); }  }
OrderedResultCalculation implements SoloResultCalculation { @Override public List<Place> getPlaces() { List<GamePlayer> allPlayers = sort(); return IntStream.range(0, allPlayers.size()) .mapToObj(value -> new Place(value + 1, allPlayers.get(value))) .collect(Collectors.toList()); }  @Override List<Place> getPlaces(); }
OrderedResultCalculation implements SoloResultCalculation { @Override public List<Place> getPlaces() { List<GamePlayer> allPlayers = sort(); return IntStream.range(0, allPlayers.size()) .mapToObj(value -> new Place(value + 1, allPlayers.get(value))) .collect(Collectors.toList()); }  @Override List<Place> getPlaces();  }