/
StateTest.java
41 lines (32 loc) · 1.08 KB
/
StateTest.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
package usantatecla.tictactoe.models;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import org.junit.jupiter.api.Test;
public class StateTest {
private State state;
public StateTest() {
this.state = new State();
}
@Test
public void testGivenNewStateWhenGetValueStateThenIsInitial() {
assertThat(this.state.getValueState(), is(StateValue.INITIAL));
}
@Test
public void testGivenNewStateWhenDoNextAndGetValueStateThenIsInGame() {
this.state.next();
assertThat(this.state.getValueState(), is(StateValue.IN_GAME));
}
@Test
public void testGivenNewStateWhenDoTwoNextAndGetValueStateThenIsResult() {
this.state.next();
this.state.next();
assertThat(this.state.getValueState(), is(StateValue.RESUME));
}
@Test
public void testGivenNewStateWhenDoThreeNextAndGetValueStateThenIsExit() {
this.state.next();
this.state.next();
this.state.next();
assertThat(this.state.getValueState(), is(StateValue.EXIT));
}
}