-
Notifications
You must be signed in to change notification settings - Fork 174
Expand file tree
/
Copy pathresultCalculationTest.java
More file actions
43 lines (34 loc) · 963 Bytes
/
resultCalculationTest.java
File metadata and controls
43 lines (34 loc) · 963 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
38
39
40
41
42
43
package utils;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import java.io.InputStream;
import static org.junit.jupiter.api.Assertions.*;
class resultCalculationTest {
private InputStream systemIn;
@BeforeEach
void setUp() {
systemIn = System.in;
}
@AfterEach
void tearDown() {
System.setIn(systemIn);
}
@Test
@DisplayName("스트라이크가 1개 이상")
void countStrikes() {
int[] game = {1, 2, 3};
int[] user = {1, 5, 3};
int result = resultCalculation.countStrikes(game, user);
assertEquals(2, result);
}
@Test
@DisplayName("볼이 2개 이상")
void countBall() {
int[] game = {1, 2, 3};
int[] user = {3, 5, 1};
int result = resultCalculation.countBall(game, user);
assertEquals(2, result);
}
}