Browse Source

player_management: added method savePlayers

player_management
Tobias Krause 3 years ago
committed by Lorenz Hohmann
parent
commit
df6f48946e
  1. 5
      src/main/java/de/tims/player_management/PlayerManager.java
  2. 14
      src/test/java/de/tims/player_management/PlayerManagerTest.java

5
src/main/java/de/tims/player_management/PlayerManager.java

@ -71,4 +71,9 @@ public class PlayerManager {
} }
} }
public void savePlayers(String fileName) {
// TODO Auto-generated method stub
}
} }

14
src/test/java/de/tims/player_management/PlayerManagerTest.java

@ -58,4 +58,18 @@ class PlayerManagerTest {
List.of(new Player("Tobias", 50), new Player("Lorenz", 40), new Player("Steffen", 60)))); List.of(new Player("Tobias", 50), new Player("Lorenz", 40), new Player("Steffen", 60))));
} }
@ParameterizedTest
@MethodSource("testCasesForSavePlayers")
void savePlayersTest(String testName, String fileName, List<Player> expectedResult) {
manager.setPlayers(expectedResult);
manager.savePlayers(fileName);
manager.loadPlayers(fileName);
List<Player> calculatedResult = manager.getPlayers();
assertThat(calculatedResult).describedAs(testName).isEqualTo(expectedResult);
}
private static Stream<Arguments> testCasesForSavePlayers() {
return Stream.of(Arguments.of("EmptyListIsWrittenAsEmptyFile", "src/test/java/resources/player_testdata2.csv", List.of()));
}
} }
Loading…
Cancel
Save