-
Notifications
You must be signed in to change notification settings - Fork 175
Expand file tree
/
Copy pathHintTest.java
More file actions
38 lines (32 loc) · 1.09 KB
/
HintTest.java
File metadata and controls
38 lines (32 loc) · 1.09 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
import static org.junit.jupiter.api.Assertions.assertEquals;
import constant.GameMessageConstant;
import data.GameResult;
import org.junit.jupiter.api.Test;
class HintTest {
@Test
void getHint_nothing() {
Hint hint = new Hint(new GameResult(0, 0));
assertEquals(hint.getHint(), GameMessageConstant.NOTHING);
}
@Test
void getHint_onlyBall() {
int ball = 1;
Hint hint = new Hint(new GameResult(ball, 0));
assertEquals(hint.getHint(), String.format("%d%s", ball, GameMessageConstant.BALL));
}
@Test
void getHint_onlyStrike() {
int strike = 3;
Hint hint = new Hint(new GameResult(0, strike));
assertEquals(hint.getHint(), String.format("%d%s", strike, GameMessageConstant.STRIKE));
}
@Test
void getHint_ballAndStrike() {
int ball = 1;
int strike = 1;
Hint hint = new Hint(new GameResult(ball, strike));
assertEquals(hint.getHint(),
String.format("%d%s %d%s", ball, GameMessageConstant.BALL, strike,
GameMessageConstant.STRIKE));
}
}