Skip to content

Commit 4b34605

Browse files
committed
test: BaseballGameTurnInput 검증 테스트 추가
1 parent 7de3921 commit 4b34605

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
package com.kakao.onboarding.precource.dukeyun.baseball.baseball;
2+
3+
import static org.assertj.core.api.Assertions.assertThatThrownBy;
4+
5+
import org.junit.jupiter.api.DisplayNameGeneration;
6+
import org.junit.jupiter.api.DisplayNameGenerator;
7+
import org.junit.jupiter.api.Test;
8+
9+
@DisplayNameGeneration(DisplayNameGenerator.ReplaceUnderscores.class)
10+
class BaseballGameTurnInputTest {
11+
12+
@Test
13+
public void 세자리가_아닌_숫자가_들어오면_예외를_발생시킨다() throws Exception {
14+
// given
15+
// when
16+
//then
17+
assertThatThrownBy(() -> {
18+
new BaseballGameTurnInput("1234");
19+
}).isInstanceOf(RuntimeException.class);
20+
}
21+
22+
@Test
23+
public void 숫자가_아니면_예외를_발생시킨다() throws Exception {
24+
// given
25+
// when
26+
//then
27+
assertThatThrownBy(() -> {
28+
new BaseballGameTurnInput("1aa");
29+
}).isInstanceOf(IllegalArgumentException.class);
30+
}
31+
32+
@Test
33+
public void 중복된_숫자면_예외를_발생시킨다() throws Exception {
34+
// given
35+
// when
36+
//then
37+
assertThatThrownBy(() -> {
38+
new BaseballGameTurnInput("112");
39+
}).isInstanceOf(RuntimeException.class);
40+
}
41+
}

0 commit comments

Comments
 (0)