diff options
author | Joffrey BION <joffrey.bion@gmail.com> | 2017-01-16 23:44:11 +0100 |
---|---|---|
committer | Joffrey BION <joffrey.bion@gmail.com> | 2017-01-16 23:44:11 +0100 |
commit | 37ae284808621312c4c3b49105d3b0efd02f53ca (patch) | |
tree | 8dbde24bdfeffc73790d32d5c8c3a8a32b781606 /src/main/java/org/luxons/sevenwonders | |
parent | Standardize PlayerRepository's API (diff) | |
download | seven-wonders-37ae284808621312c4c3b49105d3b0efd02f53ca.tar.gz seven-wonders-37ae284808621312c4c3b49105d3b0efd02f53ca.tar.bz2 seven-wonders-37ae284808621312c4c3b49105d3b0efd02f53ca.zip |
Add test for PlayerRepository
Diffstat (limited to 'src/main/java/org/luxons/sevenwonders')
-rw-r--r-- | src/main/java/org/luxons/sevenwonders/repositories/PlayerRepository.java | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/src/main/java/org/luxons/sevenwonders/repositories/PlayerRepository.java b/src/main/java/org/luxons/sevenwonders/repositories/PlayerRepository.java index 67f01808..049c5ef9 100644 --- a/src/main/java/org/luxons/sevenwonders/repositories/PlayerRepository.java +++ b/src/main/java/org/luxons/sevenwonders/repositories/PlayerRepository.java @@ -24,10 +24,7 @@ public class PlayerRepository { } } - private Player create(String username, String displayName) throws PlayerAlreadyExistsException { - if (players.containsKey(username)) { - throw new PlayerAlreadyExistsException(username); - } + private Player create(String username, String displayName) { Player player = new Player(username, displayName); players.put(username, player); return player; @@ -55,15 +52,9 @@ public class PlayerRepository { return player; } - public static class PlayerNotFoundException extends ApiMisuseException { + static class PlayerNotFoundException extends ApiMisuseException { PlayerNotFoundException(String username) { super("Player '" + username + "' doesn't exist"); } } - - private static class PlayerAlreadyExistsException extends ApiMisuseException { - PlayerAlreadyExistsException(String username) { - super("Player '" + username + "' already exists"); - } - } } |