-
Notifications
You must be signed in to change notification settings - Fork 174
Expand file tree
/
Copy pathmakeRandomNumberTest.java
More file actions
43 lines (33 loc) · 988 Bytes
/
makeRandomNumberTest.java
File metadata and controls
43 lines (33 loc) · 988 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 makeRandomNumberTest {
private InputStream systemIn;
@BeforeEach
void setUp() {
systemIn = System.in;
}
@AfterEach
void tearDown() {
System.setIn(systemIn);
}
@Test
@DisplayName(" 랜덤 숫자 생성 ")
void getRandomNumbers() {
int[] numbers = makeRandomNumber.getRandomNumbers();
assertNotNull(numbers);
assertEquals(3, numbers.length);
for (int number : numbers) {
assertTrue(number >= 1 && number <= 9);
}
for (int i = 0; i < numbers.length - 1; i++) {
for (int j = i + 1; j < numbers.length; j++) {
assertNotEquals(numbers[i], numbers[j]);
}
}
}
}