-
Notifications
You must be signed in to change notification settings - Fork 0
/
WalkingBoardStructureTest.java
122 lines (106 loc) · 3.65 KB
/
WalkingBoardStructureTest.java
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
package walking.game.tests;
import static check.CheckThat.*;
import static check.CheckThat.Condition.*;
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.*;
import org.junit.jupiter.api.condition.*;
import org.junit.jupiter.api.extension.*;
import org.junit.jupiter.params.*;
import org.junit.jupiter.params.provider.*;
import check.*;
import java.util.Arrays;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledIf;
import check.CheckThat;
public class WalkingBoardStructureTest {
@BeforeAll
public static void init() {
CheckThat.theClass("walking.game.WalkingBoard") //we added here "tests" to be as the existing one.
.thatIs(FULLY_IMPLEMENTED, INSTANCE_LEVEL, VISIBLE_TO_ALL);
}
@Test
@DisabledIf(notApplicable)
public void fieldTiles() {
it.hasField("tiles: array of array of int")
.thatIs(INSTANCE_LEVEL, MODIFIABLE, VISIBLE_TO_NONE)
.thatHas(GETTER)
.thatHasNo(SETTER);
}
@Test
@DisabledIf(notApplicable)
public void fieldX() {
it.hasField("x: int")
.thatIs(INSTANCE_LEVEL, MODIFIABLE, VISIBLE_TO_NONE)
.thatHasNo(GETTER, SETTER);
}
@Test
@DisabledIf(notApplicable)
public void fieldY() {
it.hasField("y: int")
.thatIs(INSTANCE_LEVEL, MODIFIABLE, VISIBLE_TO_NONE)
.thatHasNo(GETTER, SETTER);
}
@Test
@DisabledIf(notApplicable)
public void fieldBASE_TILE_SCORE() {
it.hasField("BASE_TILE_SCORE: int")
.thatIs(USABLE_WITHOUT_INSTANCE, NOT_MODIFIABLE, VISIBLE_TO_ALL)
.thatHasNo(GETTER, SETTER)
.withInitialValue(3);
}
@Test
@DisabledIf(notApplicable)
public void constructor01() {
it.hasConstructor(withArgs("size: int"))
.thatIs(VISIBLE_TO_ALL);
}
@Test
@DisabledIf(notApplicable)
public void constructor02() {
it.hasConstructor(withArgs("tiles: array of array of int"))
.thatIs(VISIBLE_TO_ALL);
}
@Test
@DisabledIf(notApplicable)
public void methodGetPosition() {
it.hasMethod("getPosition", withNoParams())
.thatIs(FULLY_IMPLEMENTED, INSTANCE_LEVEL, VISIBLE_TO_ALL)
.thatReturns("array of int");
}
@Test
@DisabledIf(notApplicable)
public void methodIsValidPosition() {
it.hasMethod("isValidPosition", withParams("x: int", "y: int"))
.thatIs(FULLY_IMPLEMENTED, INSTANCE_LEVEL, VISIBLE_TO_ALL)
.thatReturns("boolean");
}
@Test
@DisabledIf(notApplicable)
public void methodGetTile() {
it.hasMethod("getTile", withParams("x: int", "y: int"))
.thatIs(FULLY_IMPLEMENTED, INSTANCE_LEVEL, VISIBLE_TO_ALL)
.thatReturns("int");
}
@Test
@DisabledIf(notApplicable)
public void methodGetX() {
it.hasMethod("getXStep", withParams("direction: walking.game.util.Direction"))
.thatIs(FULLY_IMPLEMENTED, USABLE_WITHOUT_INSTANCE, VISIBLE_TO_ALL)
.thatReturns("int");
}
@Test
@DisabledIf(notApplicable)
public void methodGetY() {
it.hasMethod("getYStep", withParams("direction: walking.game.util.Direction"))
.thatIs(FULLY_IMPLEMENTED, USABLE_WITHOUT_INSTANCE, VISIBLE_TO_ALL)
.thatReturns("int");
}
@Test
@DisabledIf(notApplicable)
public void methodMoveAndSet() {
it.hasMethod("moveAndSet", withParams("TODOname: walking.game.util.Direction", "TODOname: int"))
.thatIs(FULLY_IMPLEMENTED, INSTANCE_LEVEL, VISIBLE_TO_ALL)
.thatReturns("int");
}
}