-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModelInterfaceTests.java
More file actions
67 lines (55 loc) · 1.74 KB
/
ModelInterfaceTests.java
File metadata and controls
67 lines (55 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package cs3500.reversi;
import org.junit.Before;
import org.junit.Test;
import cs3500.reversi.model.CubicPosn;
import cs3500.reversi.model.DiskState;
import cs3500.reversi.model.Reversi;
/**
* Testing class for surface level clear testing of our Model, simple functionality.
*/
public class ModelInterfaceTests {
Reversi game;
@Before
public void setup() {
game = new Reversi();
}
@Test
public void testStartGame() {
game.startGame(4);
assertEquals(4, game.getRadius());
}
@Test(expected = IllegalArgumentException.class)
public void testStartGameInvalidRadius() {
game.startGame(1);
}
@Test(expected = IllegalStateException.class)
public void testStartGameTwice() {
game.startGame(4);
game.startGame(5);
}
@Test
public void testValidPlaceTile() {
game.startGame(4);
game.placeTile(new CubicPosn(2, -1), DiskState.WHITE);
assertEquals(DiskState.WHITE, game.getBoard().get(new CubicPosn(2, -1)));
}
@Test(expected = IllegalStateException.class)
public void testPlaceTileBeforeGameStarts() {
game.placeTile(new CubicPosn(2, -1), DiskState.BLACK);
}
@Test(expected = IllegalArgumentException.class)
public void testPlaceEmptyTile() {
game.startGame(4);
game.placeTile(new CubicPosn(2, -1), DiskState.EMPTY);
}
@Test(expected = IllegalArgumentException.class)
public void testPlaceTileOutsideBoard() {
game.startGame(4);
game.placeTile(new CubicPosn(5, 5), DiskState.BLACK);
}
@Test(expected = IllegalStateException.class)
public void testPlaceTileOnOccupiedPosition() {
game.startGame(4);
game.placeTile(new CubicPosn(1, 0), DiskState.BLACK); // This position already has a tile
}
}