-
Notifications
You must be signed in to change notification settings - Fork 904
Expand file tree
/
Copy pathballTest.java
More file actions
37 lines (29 loc) · 912 Bytes
/
ballTest.java
File metadata and controls
37 lines (29 loc) · 912 Bytes
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
package baseball;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
public class ballTest {
private Ball input_com;
@BeforeEach
void setUp() {
input_com = new Ball(1, 4);
}
@Test
void strike() {
Assertions.assertEquals(input_com.play(new Ball(1, 4)), BallStatus.STRIKE);
}
@Test
void ball() {
Assertions.assertEquals(input_com.play(new Ball(2, 4)), BallStatus.BALL);
}
@Test
void nothing() {
Assertions.assertEquals(input_com.play(new Ball(3, 6)), BallStatus.NOTHING);
}
@Test
void error() {
org.assertj.core.api.Assertions.assertThatThrownBy(() -> input_com.play(new Ball(3, 10)))
.isInstanceOf(IllegalArgumentException.class)
.hasMessageContaining("1 ~ 9 사이의 숫자를 입력하세요.");
}
}