diff --git a/src/main/java/de/tims/leaderboard/Leaderboard.java b/src/main/java/de/tims/leaderboard/Leaderboard.java new file mode 100644 index 0000000..6f78e09 --- /dev/null +++ b/src/main/java/de/tims/leaderboard/Leaderboard.java @@ -0,0 +1,17 @@ +package de.tims.leaderboard; + +import java.util.List; + +import de.tims.player_management.Player; + +public class Leaderboard { + + public Leaderboard(List allPlayers, String actualPlayer) { + // TODO Auto-generated constructor stub + } + + public Player[] getTop10Players() { + return new Player[] {null, null, null, null, null, null, null, null, null, null}; + } + +} diff --git a/src/test/java/de/tims/leaderboard/LeaderboardTest.java b/src/test/java/de/tims/leaderboard/LeaderboardTest.java new file mode 100644 index 0000000..5e0fabc --- /dev/null +++ b/src/test/java/de/tims/leaderboard/LeaderboardTest.java @@ -0,0 +1,31 @@ +package de.tims.leaderboard; + +import static org.assertj.core.api.Assertions.*; + +import java.util.List; +import java.util.stream.Stream; + +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; + +import de.tims.player_management.Player; + +class LeaderboardTest { + + Leaderboard leaderboard; + + @ParameterizedTest + @MethodSource("testCasesForGetTop10Players") + void getTop10PlayersTest(String testName, List allPlayers, String actualPlayer, Player[] expectedResult) { + leaderboard = new Leaderboard(allPlayers, actualPlayer); + Player[] calculatedResutl = leaderboard.getTop10Players(); + + assertThat(calculatedResutl).describedAs(testName).isEqualTo(expectedResult); + } + + private static Stream testCasesForGetTop10Players() { + return Stream.of(Arguments.of("EmptyListReturnsEmptyArray", List.of(), "TestPlayer", new Player[] {null, null, null, null, null, null, null, null, null, null})); + } + +}