-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTilesTest.java
More file actions
76 lines (65 loc) · 2.18 KB
/
TilesTest.java
File metadata and controls
76 lines (65 loc) · 2.18 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
68
69
70
71
72
73
74
75
76
package logic.tiles;
import logic.tiles.*;
import org.junit.Test;
import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertNotNull;
public class TilesTest {
@Test
public void testBambooTile() {
for (int i = 1; i <= 9; i++) {
BambooTile tile = new BambooTile(i);
assertNotNull(tile);
assertEquals("Bamboo", tile.getType());
assertEquals(i, tile.getMagnitude());
assertEquals(i + "Bamboo", tile.toString());
}
}
@Test
public void testCharacterTile() {
for (int i = 1; i <= 9; i++) {
CharacterTile tile = new CharacterTile(i);
assertNotNull(tile);
assertEquals("Character", tile.getType());
assertEquals(i, tile.getMagnitude());
assertEquals(i + "Character", tile.toString());
}
}
@Test
public void testDotTile() {
for (int i = 1; i <= 9; i++) {
DotTile tile = new DotTile(i);
assertNotNull(tile);
assertEquals("Dot", tile.getType());
assertEquals(i, tile.getMagnitude());
assertEquals(i + "Dot", tile.toString());
}
}
@Test
public void testHonorTile() {
String[] honorTypes = {"East", "South", "West", "North", "Red", "Green", "White"};
for (String type : honorTypes) {
HonorTile tile = new HonorTile(type);
assertNotNull(tile);
assertEquals(type, tile.getType());
assertEquals(-1, tile.getMagnitude());
assertEquals(type, tile.toString());
}
}
@Test
public void testTile() {
Tile tile = new Tile() {
@Override
public int getMagnitude() {
return 5;
}
@Override
public int compareTo(Tile o) {
return Integer.compare(this.getMagnitude(), o.getMagnitude());
}
};
tile.setType("TestType");
assertNotNull(tile);
assertEquals("TestType", tile.getType());
assertEquals(5, tile.getMagnitude());
}
}