-
Notifications
You must be signed in to change notification settings - Fork 452
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
[2단계 - 자동차 경주 리팩토링] 연로그(권시연) 미션 제출합니다. #419
Merged
Merged
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
aba2e34
docs: 리드미 갱신 - 2단계 요구사항 추가
ea04b53
style: 유틸 클래스명 XXXUtils로 통일
51da0e9
refactor: 멤버 변수를 지역 변수로 변경
36efe36
test: 전진 또는 정지 테스트 코드 중복 제거
0fb6314
test: @SuppressWarnings 대신 @DisplayName 사용
b21e34d
refactor: Random 대신 ThreadLocalRandom 사용
1c977cb
refactor: 불필요한 forEach 사용 제거
97cb8c8
style: goOrStop -> go 메소드 이름 변경
44f25fc
style: 패키지명 model -> domain 변경
154e848
refactor: utils 에서는 생성자 제한
eea0010
fix: git conflicts 해결
57efde6
refactor: 기본 toString() 생성
f898133
style: 메소드 순서 변경
9090de1
refactor: 메소드명 변경, 미사용 메소드 삭제
d192408
refactor: 미사용 메소드 제거
de49f39
style: 메소드 이름 변경
2528710
refactor: parseInt전에 input값 검증
fb37928
refactor: 랜덤값에 대해 전략 패턴 사용
70e667e
refactor: Exception이 발생 가능한 inputCarNames에 대한 처리 분리
6dbe286
fix: 사용자 입력 시 공백을 포함해 받을 수 있도록 수정
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이 부분을 수정을 했었는데 PR 충돌 해결하면서 코드가 다시 바뀌었던 것 같아요
사용자가 직접 입력하는 값도 테스트를 할 수 있나요?
할 수 있다면 어떤 방법을 사용할까요?
처음엔 전략 패턴을 적용시키면 가능할까해서 만들어보다가 그냥 문자열에 대한 테스트가 될뿐 사용자가 의도한대로 입력이 되었는지에 대한 테스트가 아닌 것 같아서 롤백했습니다.😭
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
연로그가 이끌어낸 결론이 제가 생각한 질문이었어요🙂
사용자가 직접 입력하는 것은 우리가 제어할 수 있는 대상이 아니니 테스트 대상이 아니라고 판단하는게 맞을 것 같아요. 그렇다면 우리가 제어할 수 없는 사용자 입력을 어떻게 제어할 수 있는 범위로 넣을 것인가?를 고민했을 때 전략패턴으로 이를 해결할 수 있구요.
다만 연로그가 말한 것 처럼 사용자가입력한 값 == 문자열에 대한 테스트가 될 확률이 높겠죠? 그렇기에 불필요하다면 추가하지 않는 것도 방법이에요.
조금 더 나아가서 프로그램 전체가 올바르게 동작한다 즉 레이싱컨트롤러.start()를 했을 때 전체 프로그램이 동작한다를 증명하려면 입력에 대한 전략패턴이 분명 필요해질 수 있겠죠? 어떤 것을 테스트할 것인가에 따라 전략패턴도, 다른 기법들도 사용될지 아닐지가 달라질 수 있다는 점까지 염두해두면 더 좋을 것 같습니다🙂