-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathApplicationTest.java
More file actions
70 lines (60 loc) · 2.01 KB
/
Copy pathApplicationTest.java
File metadata and controls
70 lines (60 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
package racingcar;
import camp.nextstep.edu.missionutils.test.NsTest;
import org.junit.jupiter.api.Test;
import static camp.nextstep.edu.missionutils.test.Assertions.assertRandomNumberInRangeTest;
import static camp.nextstep.edu.missionutils.test.Assertions.assertSimpleTest;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
class ApplicationTest extends NsTest {
private static final int MOVING_FORWARD = 4;
private static final int STOP = 3;
@Test
void functionTest() {
assertRandomNumberInRangeTest(
() -> {
run("pobi,woni", "1");
assertThat(output()).contains("pobi : -", "woni : ", "최종 우승자 : pobi");
},
MOVING_FORWARD, STOP
);
}
@Test
void isEmpty1() {
assertSimpleTest(() ->
assertThatThrownBy(() -> runException("", "1"))
.isInstanceOf(IllegalArgumentException.class)
);
}
@Test
void isEmpty2() {
assertSimpleTest(() ->
assertThatThrownBy(() -> runException("pobi,woni", " "))
.isInstanceOf(IllegalArgumentException.class)
);
}
@Test
void isEmpty3() {
assertSimpleTest(() ->
assertThatThrownBy(() -> runException("pobi, ", "1"))
.isInstanceOf(IllegalArgumentException.class)
);
}
@Test
void overFlow() {
assertSimpleTest(() ->
assertThatThrownBy(() -> runException("pobi,woni ", "10000000000000000000"))
.isInstanceOf(IllegalArgumentException.class)
);
}
@Test
void notPositiveNumber() {
assertSimpleTest(() ->
assertThatThrownBy(() -> runException("pobi,woni ", "-1"))
.isInstanceOf(IllegalArgumentException.class)
);
}
@Override
public void runMain() {
Application.main(new String[]{});
}
}