forked from next-step/java-baseball-playground
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathGameServiceTest.java
More file actions
48 lines (39 loc) · 1.38 KB
/
GameServiceTest.java
File metadata and controls
48 lines (39 loc) · 1.38 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
package baseball.api;
import baseball.domain.Number;
import baseball.domain.Numbers;
import baseball.infra.FakeBaseballInputClientImpl;
import baseball.infra.FakeRandomNumbersSpecification;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import java.util.Arrays;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
class GameServiceTest {
private BaseballService baseballService = new BaseballService(new FakeRandomNumbersSpecification(), new FakeBaseballInputClientImpl());
@Test
@DisplayName("임의로 숫자를 저장한다.")
void test1() {
//when & then
assertDoesNotThrow(
() -> baseballService.storeRandomNumbers()
);
}
@Test
@DisplayName("숫자는 Random API를 이용해 가져와 저장한다")
void test2() {
//given
Numbers numbers = baseballService.storeRandomNumbers();
List<Number> numberList = Arrays.asList(new Number(4), new Number(9), new Number(3));
//when & then
assertThat(numbers.getNumbers().containsAll(numberList)).isTrue();
}
@Test
@DisplayName("숫자를 입력받는다.")
void test3() {
//given & when & then
assertDoesNotThrow(
() -> baseballService.inputNumbers()
);
}
}