Skip to content

Commit aa39c55

Browse files
committed
feat : test
1 parent a2537a0 commit aa39c55

54 files changed

Lines changed: 1127 additions & 747 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 138 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,138 @@
1-
# 볼링 게임 점수판
2-
## 진행 방법
3-
* 볼링 게임 점수판 요구사항을 파악한다.
4-
* 요구사항에 대한 구현을 완료한 후 자신의 github 아이디에 해당하는 브랜치에 Pull Request(이하 PR)를 통해 코드 리뷰 요청을 한다.
5-
* 코드 리뷰 피드백에 대한 개선 작업을 하고 다시 PUSH한다.
6-
* 모든 피드백을 완료하면 다음 단계를 도전하고 앞의 과정을 반복한다.
7-
8-
## 온라인 코드 리뷰 과정
9-
* [텍스트와 이미지로 살펴보는 온라인 코드 리뷰 과정](https://github.com/next-step/nextstep-docs/tree/master/codereview)
1+
```
2+
플레이어 이름은 (3 english letters)?: aaa
3+
| NAME | 01 | 02 | 03 | 04 | 05 | 06 | 07 | 08 | 09 | 10 |
4+
| aaa | | | | | | | | | | |
5+
1프레임 투구: 1
6+
| NAME | 01 | 02 | 03 | 04 | 05 | 06 | 07 | 08 | 09 | 10 |
7+
| aaa | 1 | | | | | | | | | |
8+
1프레임 투구: 2
9+
| NAME | 01 | 02 | 03 | 04 | 05 | 06 | 07 | 08 | 09 | 10 |
10+
| aaa | 1|2 | | | | | | | | | |
11+
2프레임 투구: 2
12+
| NAME | 01 | 02 | 03 | 04 | 05 | 06 | 07 | 08 | 09 | 10 |
13+
| aaa | 1|2 | 2 | | | | | | | | |
14+
2프레임 투구: 8
15+
| NAME | 01 | 02 | 03 | 04 | 05 | 06 | 07 | 08 | 09 | 10 |
16+
| aaa | 1|2 | 2|/ | | | | | | | | |
17+
3프레임 투구: 2
18+
| NAME | 01 | 02 | 03 | 04 | 05 | 06 | 07 | 08 | 09 | 10 |
19+
| aaa | 1|2 | 2|/ | 2 | | | | | | | |
20+
3프레임 투구: 3
21+
| NAME | 01 | 02 | 03 | 04 | 05 | 06 | 07 | 08 | 09 | 10 |
22+
| aaa | 1|2 | 2|/ | 2|3 | | | | | | | |
23+
4프레임 투구: 10
24+
| NAME | 01 | 02 | 03 | 04 | 05 | 06 | 07 | 08 | 09 | 10 |
25+
| aaa | 1|2 | 2|/ | 2|3 | X | | | | | | |
26+
5프레임 투구: 10
27+
| NAME | 01 | 02 | 03 | 04 | 05 | 06 | 07 | 08 | 09 | 10 |
28+
| aaa | 1|2 | 2|/ | 2|3 | X | X | | | | | |
29+
6프레임 투구: 10
30+
| NAME | 01 | 02 | 03 | 04 | 05 | 06 | 07 | 08 | 09 | 10 |
31+
| aaa | 1|2 | 2|/ | 2|3 | X | X | X | | | | |
32+
7프레임 투구: 10
33+
| NAME | 01 | 02 | 03 | 04 | 05 | 06 | 07 | 08 | 09 | 10 |
34+
| aaa | 1|2 | 2|/ | 2|3 | X | X | X | X | | | |
35+
8프레임 투구: 10
36+
| NAME | 01 | 02 | 03 | 04 | 05 | 06 | 07 | 08 | 09 | 10 |
37+
| aaa | 1|2 | 2|/ | 2|3 | X | X | X | X | X | | |
38+
9프레임 투구: 10
39+
| NAME | 01 | 02 | 03 | 04 | 05 | 06 | 07 | 08 | 09 | 10 |
40+
| aaa | 1|2 | 2|/ | 2|3 | X | X | X | X | X | X | |
41+
10프레임 투구: 10
42+
| NAME | 01 | 02 | 03 | 04 | 05 | 06 | 07 | 08 | 09 | 10 |
43+
| aaa | 1|2 | 2|/ | 2|3 | X | X | X | X | X | X | X |
44+
10프레임 투구: 10
45+
| NAME | 01 | 02 | 03 | 04 | 05 | 06 | 07 | 08 | 09 | 10 |
46+
| aaa | 1|2 | 2|/ | 2|3 | X | X | X | X | X | X | X|X |
47+
10프레임 투구: 10
48+
| NAME | 01 | 02 | 03 | 04 | 05 | 06 | 07 | 08 | 09 | 10 |
49+
| aaa | 1|2 | 2|/ | 2|3 | X | X | X | X | X | X | X|X|X|
50+
```
51+
52+
----
53+
```
54+
플레이어 이름은(3 english letters)?:aaa
55+
| NAME | 01 | 02 | 03 | 04 | 05 | 06 | 07 | 08 | 09 | 10 |
56+
| aaa | | | | | | | | | | |
57+
| | | | | | | | | | | |
58+
59+
1프레임 투구 :1
60+
| NAME | 01 | 02 | 03 | 04 | 05 | 06 | 07 | 08 | 09 | 10 |
61+
| aaa | 1 | | | | | | | | | |
62+
| | | | | | | | | | | |
63+
64+
1프레임 투구 :9
65+
| NAME | 01 | 02 | 03 | 04 | 05 | 06 | 07 | 08 | 09 | 10 |
66+
| aaa | 1|/ | | | | | | | | | |
67+
| | | | | | | | | | | |
68+
69+
2프레임 투구 :10
70+
| NAME | 01 | 02 | 03 | 04 | 05 | 06 | 07 | 08 | 09 | 10 |
71+
| aaa | 1|/ | x | | | | | | | | |
72+
| | 20 | | | | | | | | | |
73+
74+
3프레임 투구 :10
75+
| NAME | 01 | 02 | 03 | 04 | 05 | 06 | 07 | 08 | 09 | 10 |
76+
| aaa | 1|/ | x | x | | | | | | | |
77+
| | 20 | | | | | | | | | |
78+
79+
4프레임 투구 :10
80+
| NAME | 01 | 02 | 03 | 04 | 05 | 06 | 07 | 08 | 09 | 10 |
81+
| aaa | 1|/ | x | x | x | | | | | | |
82+
| | 20 | 50 | | | | | | | | |
83+
84+
5프레임 투구 :2
85+
| NAME | 01 | 02 | 03 | 04 | 05 | 06 | 07 | 08 | 09 | 10 |
86+
| aaa | 1|/ | x | x | x | 2 | | | | | |
87+
| | 20 | 50 | 72 | | | | | | | |
88+
89+
5프레임 투구 :8
90+
| NAME | 01 | 02 | 03 | 04 | 05 | 06 | 07 | 08 | 09 | 10 |
91+
| aaa | 1|/ | x | x | x | 2|/ | | | | | |
92+
| | 20 | 50 | 72 | 92 | | | | | | |
93+
94+
6프레임 투구 :10
95+
| NAME | 01 | 02 | 03 | 04 | 05 | 06 | 07 | 08 | 09 | 10 |
96+
| aaa | 1|/ | x | x | x | 2|/ | x | | | | |
97+
| | 20 | 50 | 72 | 92 | 112 | | | | | |
98+
99+
7프레임 투구 :10
100+
| NAME | 01 | 02 | 03 | 04 | 05 | 06 | 07 | 08 | 09 | 10 |
101+
| aaa | 1|/ | x | x | x | 2|/ | x | x | | | |
102+
| | 20 | 50 | 72 | 92 | 112 | | | | | |
103+
104+
8프레임 투구 :2
105+
| NAME | 01 | 02 | 03 | 04 | 05 | 06 | 07 | 08 | 09 | 10 |
106+
| aaa | 1|/ | x | x | x | 2|/ | x | x | 2 | | |
107+
| | 20 | 50 | 72 | 92 | 112 | 134 | | | | |
108+
109+
8프레임 투구 :8
110+
| NAME | 01 | 02 | 03 | 04 | 05 | 06 | 07 | 08 | 09 | 10 |
111+
| aaa | 1|/ | x | x | x | 2|/ | x | x | 2|/ | | |
112+
| | 20 | 50 | 72 | 92 | 112 | 134 | 154 | | | |
113+
114+
9프레임 투구 :1
115+
| NAME | 01 | 02 | 03 | 04 | 05 | 06 | 07 | 08 | 09 | 10 |
116+
| aaa | 1|/ | x | x | x | 2|/ | x | x | 2|/ | 1 | |
117+
| | 20 | 50 | 72 | 92 | 112 | 134 | 154 | 165 | | |
118+
119+
9프레임 투구 :9
120+
| NAME | 01 | 02 | 03 | 04 | 05 | 06 | 07 | 08 | 09 | 10 |
121+
| aaa | 1|/ | x | x | x | 2|/ | x | x | 2|/ | 1|/ | |
122+
| | 20 | 50 | 72 | 92 | 112 | 134 | 154 | 165 | | |
123+
124+
10프레임 투구 :2
125+
| NAME | 01 | 02 | 03 | 04 | 05 | 06 | 07 | 08 | 09 | 10 |
126+
| aaa | 1|/ | x | x | x | 2|/ | x | x | 2|/ | 1|/ | 2 |
127+
| | 20 | 50 | 72 | 92 | 112 | 134 | 154 | 165 | 177 | |
128+
129+
10프레임 투구 :8
130+
| NAME | 01 | 02 | 03 | 04 | 05 | 06 | 07 | 08 | 09 | 10 |
131+
| aaa | 1|/ | x | x | x | 2|/ | x | x | 2|/ | 1|/ | 2|8 |
132+
| | 20 | 50 | 72 | 92 | 112 | 134 | 154 | 165 | 177 | |
133+
134+
10프레임 투구 :2
135+
| NAME | 01 | 02 | 03 | 04 | 05 | 06 | 07 | 08 | 09 | 10 |
136+
| aaa | 1|/ | x | x | x | 2|/ | x | x | 2|/ | 1|/ | 2|8|2|
137+
| | 20 | 50 | 72 | 92 | 112 | 134 | 154 | 165 | 177 | 189 |
138+
```

build.gradle

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,22 @@
11
plugins {
2-
id 'org.springframework.boot' version '2.6.4'
3-
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
4-
id 'java'
2+
id 'java'
53
}
64

7-
group = 'camp.nextstep'
8-
version = '1.0.0'
9-
sourceCompatibility = '11'
10-
115
repositories {
126
mavenCentral()
7+
maven { url 'https://jitpack.io' }
138
}
149

1510
dependencies {
16-
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
17-
runtimeOnly 'com.h2database:h2'
18-
testImplementation 'org.assertj:assertj-core:3.22.0'
19-
testImplementation 'org.springframework.boot:spring-boot-starter-test'
11+
implementation 'com.github.woowacourse-projects:mission-utils:1.0.0'
12+
}
13+
14+
java {
15+
toolchain {
16+
languageVersion = JavaLanguageVersion.of(11)
17+
}
2018
}
2119

22-
tasks.named('test') {
20+
test {
2321
useJUnitPlatform()
2422
}

docs/README.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# 📌 핵심 기능:
2+
3+
# 👩‍💻프로그램 동작 흐름
4+
- [x] 플레이어의 이름을 입력받는다.
5+
- 프레임투구 입력, 출력을 9번 반복한다. (1~9 프레임까지)
6+
- 10번 프레임투구를 입력받고 출력한다..
7+
8+
9+
10+
# 기능 구현 목록
11+
## 🖨️ 입출력 기능
12+
13+
### 입력 기능
14+
15+
- 플레이어 이름 입력받는 기능
16+
- ⚠️예외 검증: 플레이어 이름 입력 형식
17+
- [x] 공백이 아닌지
18+
- [x] 한글이 아닌지
19+
20+
- ⚠️예외 검증: 플레이어 이름 객체
21+
- [x] 3글자인지
22+
23+
24+
- 프레임투구 입력받는 기능
25+
- ⚠️예외 검증: 프레임투구 입력 형식
26+
- [ ] 공백이 아닌지
27+
- [ ] 숫자인지
28+
- [ ] integer 범위 내의 숫자인지
29+
30+
- ⚠️예외 검증: 프레임투구 객체
31+
- [ ] 0~10 범위의 숫자인지
32+
33+
34+
### 출력 기능
35+
36+
- [ ] 투구별 점수판을 출력하는 기능
37+
38+
## 🏃‍♀️ 프로그램 진행 기능
39+
- [ ] 플레이어 이름을 입력받아 생성한다.
40+
- [ ] 점수판을 초기화 한다.
41+
- [ ]
42+
43+
44+
# ✅ 체크할 점
45+
-[ ]
46+
-[ ]
47+
48+
# 🛠 리팩토링 목록
49+
## 요구사항
50+
- [ ] indent (2)
51+
- [ ] 메서드 길이 (15)
52+
- [ ] 단위 테스트 모두 됐는지 확인
53+
## 그 외
54+
- [ ] 컨트롤러 메소드 네이밍 정리 및 분리 개선
55+
- [ ] 숫자 리터럴 상수화
56+
- [ ] 일급 컬렉션 필요 부분 확인
57+
- [ ] 원시값 포장 확인
58+
---
59+
- [ ] 부생성자가 있는 경우 생성자의 접근제어자가 private인지
60+
- [ ] 객체 생성이 불필요한 경우 private 생성자가 있는지
61+
- [ ] 각 클래스의 책임 범위 위반한 것 없는지 점검하기
62+
- [ ] 각 클래스 메소드 순서 점검하기
63+
- [ ] 이해를 위한 코드 전반의 공백 추가
64+
- [ ] 테스트 코드 리팩토링
65+
- [ ] getter 리스트 레퍼런스에 unmodifaible 추가
66+
----
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package bowling;
2+
3+
import bowling.view.InputView;
4+
import bowling.view.printer.ConsolePrinter;
5+
import bowling.view.printer.Printer;
6+
import bowling.view.reader.ConsoleReader;
7+
import bowling.view.reader.Reader;
8+
9+
public class Application {
10+
public static void main(String[] args) {
11+
Reader reader = new ConsoleReader();
12+
Printer printer = new ConsolePrinter();
13+
InputView inputView = InputView.of(reader, printer);
14+
}
15+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package bowling.common;
2+
3+
public class Symbol {
4+
private Symbol() {
5+
}
6+
7+
public static final String HYPHEN = "-";
8+
9+
public static final String COMMA = ",";
10+
}
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
package bowling.controller;
2+
3+
import bowling.domain.Ball;
4+
import bowling.domain.FrameBoard;
5+
import bowling.domain.PlayerName;
6+
import bowling.view.InputView;
7+
import bowling.view.OutputView;
8+
import java.util.function.Supplier;
9+
10+
public class BowlingController {
11+
private final InputView inputView;
12+
private final OutputView outputView;
13+
14+
public BowlingController(InputView inputView, OutputView outputView) {
15+
this.inputView = inputView;
16+
this.outputView = outputView;
17+
}
18+
19+
public void run() {
20+
PlayerName playerName = inputView.inputPlayerName();
21+
FrameBoard frameBoard = FrameBoard.init(playerName);
22+
outputView.printBoard(frameBoard);
23+
24+
playFrames(frameBoard);
25+
}
26+
27+
private void playFrames(FrameBoard frameBoard) {
28+
int frameIndex = 0;
29+
30+
while (!frameBoard.hasEmptyFrame()) {
31+
playFrame(frameBoard, frameIndex);
32+
frameIndex++;
33+
}
34+
35+
playBonusBall(frameBoard);
36+
}
37+
38+
private void playBonusBall(FrameBoard frameBoard) {
39+
playFrame(frameBoard, 9);
40+
if (frameBoard.needLastFrameBonus()) {
41+
Ball bonusBall = inputView.inputBall(9);
42+
frameBoard.applyBonusBall(bonusBall);
43+
outputView.printBoard(frameBoard);
44+
}
45+
}
46+
47+
private void playFrame(FrameBoard frameBoard, int frameIndex) {
48+
frameIndex = frameBoard.getNextFrameIndes();
49+
Ball firstBall = inputView.inputBall(frameIndex);
50+
frameBoard.applyFirstBallOf(frameIndex, firstBall);
51+
outputView.printBoard(frameBoard);
52+
53+
if (!firstBall.isStrike()) {
54+
Ball secondBall = inputView.inputBall(frameIndex);
55+
frameBoard.applySecondBallOf(frameIndex, secondBall);
56+
outputView.printBoard(frameBoard);
57+
}
58+
59+
60+
}
61+
62+
private <T> T readWithRetry(Supplier<T> supplier) {
63+
try {
64+
return supplier.get();
65+
} catch (IllegalArgumentException e) {
66+
outputView.printExceptionMessage(e.getMessage());
67+
return readWithRetry(supplier);
68+
}
69+
}
70+
}

0 commit comments

Comments
 (0)