|
8 | 8 | import static com.andrewswan.powergrid.domain.impl.StandardGame.CITIES_TO_END_4_PLAYER_GAME; |
9 | 9 | import static com.andrewswan.powergrid.domain.impl.StandardGame.CITIES_TO_END_5_PLAYER_GAME; |
10 | 10 | import static com.andrewswan.powergrid.domain.impl.StandardGame.CITIES_TO_END_6_PLAYER_GAME; |
| 11 | +import static org.mockito.Mockito.mock; |
11 | 12 |
|
12 | 13 | import java.util.HashSet; |
13 | 14 | import java.util.Set; |
14 | 15 |
|
15 | 16 | import junit.framework.TestCase; |
16 | 17 |
|
17 | | -import com.andrewswan.powergrid.EasyMockContainer; |
| 18 | +import org.mockito.Mock; |
| 19 | +import org.mockito.MockitoAnnotations; |
| 20 | + |
18 | 21 | import com.andrewswan.powergrid.domain.Board; |
19 | 22 | import com.andrewswan.powergrid.domain.Game; |
20 | 23 | import com.andrewswan.powergrid.domain.Player; |
|
25 | 28 | public class StandardGameTest extends TestCase { |
26 | 29 |
|
27 | 30 | // Fixture |
28 | | - private EasyMockContainer mocks; |
29 | 31 | private StandardGame game; |
30 | | - private Board mockBoard; |
| 32 | + @Mock private Board mockBoard; |
31 | 33 |
|
32 | 34 | @Override |
33 | 35 | protected void setUp() throws Exception { |
34 | 36 | super.setUp(); |
35 | | - mocks = new EasyMockContainer(); |
36 | | - mockBoard = mocks.createStrictMock(Board.class); |
| 37 | + MockitoAnnotations.initMocks(this); |
37 | 38 | } |
38 | 39 |
|
39 | 40 | public void testCitiesToEndTwoPlayerGame() { |
@@ -70,16 +71,14 @@ private void assertEndCitiesForNumberOfPlayers( |
70 | 71 | game = new StandardGame(mockBoard, numberOfPlayers); |
71 | 72 | final Set<Player> players = new HashSet<Player>(); |
72 | 73 | for (int i = 0; i < numberOfPlayers; i++) { |
73 | | - players.add(mocks.createStrictMock(Player.class)); |
| 74 | + players.add(mock(Player.class)); |
74 | 75 | } |
75 | 76 | game.setPlayers(players); |
76 | | - mocks.replay(); |
77 | 77 |
|
78 | 78 | // Invoke and check |
79 | 79 | final int numberOfCitiesToEndGame = game.getNumberOfCitiesToEndGame(); |
80 | 80 |
|
81 | 81 | // Check |
82 | | - mocks.verify(); |
83 | 82 | assertEquals(expectedNumberOfCities, numberOfCitiesToEndGame); |
84 | 83 | } |
85 | 84 | } |
0 commit comments