Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[자동차 경주 게임] 박준수 미션 제출합니다. #3

Open
wants to merge 41 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
ee97879
docs: 기능 구현 정의
GaBaljaintheroom Sep 8, 2023
d6736be
feat: InputView readCarNames 작성
GaBaljaintheroom Sep 8, 2023
e40863f
feat: OutputView 생성
GaBaljaintheroom Sep 8, 2023
6be50c5
feat: ProgressMessage INPUT_CAR_NAMES 작성
GaBaljaintheroom Sep 8, 2023
579574f
feat: ErrorMessage 생성
GaBaljaintheroom Sep 8, 2023
1f32e20
feat: InputValidator 생성
GaBaljaintheroom Sep 8, 2023
fcffeb0
test: 쉼표를 포함하여 입력값을 2명이상 입력하지 않았을 때 에러가 발생
GaBaljaintheroom Sep 8, 2023
13501c9
test: 자동차 이름이 5자를 초과하면 에러가 발생
GaBaljaintheroom Sep 8, 2023
862c683
feat: Car validateCarNameLength 추가
GaBaljaintheroom Sep 8, 2023
da9476f
feat: Cars addCars 작성
GaBaljaintheroom Sep 8, 2023
bed5643
feat: InputView readTryCount 작성
GaBaljaintheroom Sep 8, 2023
6e1db51
feat: InputValidator validateTryCount 작성
GaBaljaintheroom Sep 8, 2023
9d52a2d
feat: ErrorMessage TRY_COUNT_ERROR 작성
GaBaljaintheroom Sep 8, 2023
3577d1d
feat: ProgressMessage INPUT_TRY_COUNT 작성
GaBaljaintheroom Sep 8, 2023
1f941ea
feat: OutputView printInputTryCount 작성
GaBaljaintheroom Sep 8, 2023
1ee97d4
test: 시도할 횟수가 1회 이상이 아니라면 에러가 발생
GaBaljaintheroom Sep 8, 2023
b1ef153
feat: CreateRandomValue 생성
GaBaljaintheroom Sep 8, 2023
298f03f
feat: RacingCarService moveCars 작성
GaBaljaintheroom Sep 8, 2023
aa28507
feat: Car movePosition 작성
GaBaljaintheroom Sep 8, 2023
70da97e
feat: Cars moveCars 작성
GaBaljaintheroom Sep 8, 2023
ca64fe3
feat: Car makeScreen 작성
GaBaljaintheroom Sep 8, 2023
7620eaf
feat: Cars executionResult 작성
GaBaljaintheroom Sep 8, 2023
a27c098
feat: OutputView printExecuteResult 작성
GaBaljaintheroom Sep 8, 2023
185a1b1
feat: OutputView printCarsStatus 작성
GaBaljaintheroom Sep 8, 2023
d8d28fc
feat: ProgressMessage EXECUTE_RESULT 작성
GaBaljaintheroom Sep 8, 2023
e613eff
feat: RacingCarService moveCars 작성
GaBaljaintheroom Sep 8, 2023
bf3ba33
feat: RacingCarController run 작성
GaBaljaintheroom Sep 8, 2023
a9e6db7
test: 자동차를 추가했을 때 차를 움직이면 실행결과에 이름이 나타난다.
GaBaljaintheroom Sep 8, 2023
527c152
feat: Car getter 추가
GaBaljaintheroom Sep 8, 2023
ac8c13e
feat: Cars finalWinner 추가
GaBaljaintheroom Sep 8, 2023
a0402b0
feat: OutputView printFinalWinner 추가
GaBaljaintheroom Sep 8, 2023
13cdefd
feat: ProgressMessage FINAL_WINNER 추가
GaBaljaintheroom Sep 8, 2023
2c47b76
feat: controller run 수정
GaBaljaintheroom Sep 8, 2023
e181959
test: 게임에서 이긴 최종 우승자의 이름을 나타난다.
GaBaljaintheroom Sep 8, 2023
064c898
feat: main 함수 작성
GaBaljaintheroom Sep 8, 2023
3f22d55
refactor: import 변경
GaBaljaintheroom Sep 8, 2023
82442ce
refactor: InputValidator validateNumeric 추가
GaBaljaintheroom Sep 8, 2023
b8c7566
refactor: 상수 처리 추가
GaBaljaintheroom Sep 8, 2023
97da3e9
refactor: 패키지 구조 변경
GaBaljaintheroom Sep 8, 2023
8cb4433
refactor: 패키지 구조 변경
GaBaljaintheroom Sep 8, 2023
8621d8b
docs: 리드미 수정
GaBaljaintheroom Sep 8, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: InputValidator 생성
  • Loading branch information
GaBaljaintheroom committed Sep 8, 2023
commit 1f32e203aeda42f9469b3f9a8ee91d250db05057
19 changes: 19 additions & 0 deletions src/main/java/racingcar/InputValidator.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package racingcar;

import java.util.Arrays;
import java.util.Set;
import java.util.stream.Collectors;

public class InputValidator {

private static final int MIN_NAME_SIZE = 2;
private static final String DIVISION = ",";

public void validateContainDivision(String name) {
Set<String> carNames = Arrays.stream(name.split(DIVISION)).collect(Collectors.toSet());
if(carNames.size() < MIN_NAME_SIZE){
throw new IllegalArgumentException(ErrorMessage.NAME_DIVISION_ERROR.getMessage());
}
}

}