Repository navigation
Expand file tree
/
Copy pathFrameTest.java
More file actions
93 lines (75 loc) · 2.01 KB
/
Copy pathFrameTest.java
File metadata and controls
93 lines (75 loc) · 2.01 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
package bowling;
import org.junit.Before;
import org.junit.Test;
import static org.assertj.core.api.Assertions.assertThat;
public class FrameTest {
private Frame frame;
@Before
public void setup() {
frame = new Frame();
}
@Test
public void displayText_투구전() {
assertThat(frame.displayText()).isEqualTo("");
}
@Test
public void displayText_첫번째_투구() {
frame.bowl(7);
assertThat(frame.displayText()).isEqualTo("7");
}
@Test
public void displayText_strike() {
frame.bowl(10);
assertThat(frame.displayText()).isEqualTo("X");
}
@Test
public void displayText_spare() {
frame.bowl(8);
frame.bowl(2);
assertThat(frame.displayText()).isEqualTo("8|/");
}
@Test
public void displayText_miss() {
frame.bowl(8);
frame.bowl(1);
assertThat(frame.displayText()).isEqualTo("8|1");
}
@Test
public void isFinish_running() {
assertThat(frame.isFinish()).isFalse();
frame.bowl(8);
assertThat(frame.isFinish()).isFalse();
}
@Test
public void isFinish_finished() {
frame.bowl(10);
assertThat(frame.isFinish()).isTrue();
frame = new Frame();
frame.bowl(8);
frame.bowl(2);
assertThat(frame.isFinish()).isTrue();
frame = new Frame();
frame.bowl(8);
frame.bowl(1);
assertThat(frame.isFinish()).isTrue();
}
@Test(expected = IllegalArgumentException.class)
public void bowl_when_finish() {
frame.bowl(8);
frame.bowl(2);
frame.bowl(9);
}
@Test(expected = IllegalArgumentException.class)
public void bowl_under_pin() {
frame.bowl(-1);
}
@Test(expected = IllegalArgumentException.class)
public void bowl_over_pin() {
frame.bowl(11);
}
@Test(expected = IllegalArgumentException.class)
public void bowl_over_totalpin() {
frame.bowl(8);
frame.bowl(3);
}
}