From d5339282177331571912f91c72489b0f986eb3f8 Mon Sep 17 00:00:00 2001 From: Sandor Van Wassenhove Date: Sun, 18 Oct 2015 22:59:43 -0700 Subject: [PATCH] HumanPlayer tests should use PlayerFactory --- .../github/sandorw/mocabogaso/players/HumanPlayerTest.java | 6 +++--- .../{AIPlayerFactoryTest.java => PlayerFactoryTest.java} | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) rename src/test/java/com/github/sandorw/mocabogaso/players/{AIPlayerFactoryTest.java => PlayerFactoryTest.java} (96%) diff --git a/src/test/java/com/github/sandorw/mocabogaso/players/HumanPlayerTest.java b/src/test/java/com/github/sandorw/mocabogaso/players/HumanPlayerTest.java index 1dc8d01..430f2ba 100644 --- a/src/test/java/com/github/sandorw/mocabogaso/players/HumanPlayerTest.java +++ b/src/test/java/com/github/sandorw/mocabogaso/players/HumanPlayerTest.java @@ -18,7 +18,7 @@ * @author sandorw */ public final class HumanPlayerTest { - private HumanPlayer player; + private Player player; private SimpleTestGameState gameState; @Before @@ -30,7 +30,7 @@ public void before() { public void chooseNextMoveValidMoveTest() { InputStream inputStream = new ByteArrayInputStream("1".getBytes(Charset.forName("UTF-8"))); System.setIn(inputStream); - player = new HumanPlayer<>(); + player = PlayerFactory.getNewHumanPlayer(); DefaultGameMove move = player.chooseNextMove(gameState); assertEquals(move.getLocation(), 1); System.setIn(System.in); @@ -40,7 +40,7 @@ public void chooseNextMoveValidMoveTest() { public void chooseNextMoveInvalidMoveTest() { InputStream inputStream = new ByteArrayInputStream("4 4 1".getBytes(Charset.forName("UTF-8"))); System.setIn(inputStream); - player = new HumanPlayer<>(); + player = PlayerFactory.getNewHumanPlayer(); DefaultGameMove move = player.chooseNextMove(gameState); assertEquals(move.getLocation(), 1); System.setIn(System.in); diff --git a/src/test/java/com/github/sandorw/mocabogaso/players/AIPlayerFactoryTest.java b/src/test/java/com/github/sandorw/mocabogaso/players/PlayerFactoryTest.java similarity index 96% rename from src/test/java/com/github/sandorw/mocabogaso/players/AIPlayerFactoryTest.java rename to src/test/java/com/github/sandorw/mocabogaso/players/PlayerFactoryTest.java index 2e93492..53e27d8 100644 --- a/src/test/java/com/github/sandorw/mocabogaso/players/AIPlayerFactoryTest.java +++ b/src/test/java/com/github/sandorw/mocabogaso/players/PlayerFactoryTest.java @@ -10,11 +10,11 @@ import com.github.sandorw.mocabogaso.games.test.SimpleTestGameState; /** - * Test cases for AIPlayerFactory + * Test cases for PlayerFactory * * @author sandorw */ -public final class AIPlayerFactoryTest { +public final class PlayerFactoryTest { SimpleTestGameState gameState; Game game;