-
Notifications
You must be signed in to change notification settings - Fork 362
Step1 제출합니다. #1166
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
Open
hjlee83
wants to merge
13
commits into
next-step:hjlee83
Choose a base branch
from
hjlee83:step1
base: hjlee83
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Step1 제출합니다. #1166
Conversation
This file contains hidden or 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
기능 요구사항과 관련된 내용을 README.md에 작성.
로또샵에서 금액을 입력받아 로또를 구매할 수 있는 기능을 추가. 1000원 단위가 아닌 금액 입력 시 예외 처리 추가. test: 로또 구매 기능에 대한 테스트 코드 작성.
로또 생성 클래스와 구매 후 번호를 출력하는 기능을 추가. 로또 구매 시 로또 객체를 반환하도록 변경하고, 테스트 코드 수정 및 추가. footer: JVM Toolchain 17로 버전 변경.
당첨 번호와 구매한 로또를 비교해 당첨 결과 통계 및 수익률을 계산하는 기능 추가. Rank enum 생성으로 당첨 등수 및 상금을 관리하고 LottoResult 클래스에서 결과를 처리하도록 구현. footer: 테스트 코드 및 README.md 업데이트.
men7627
reviewed
Nov 20, 2025
men7627
reviewed
Nov 20, 2025
men7627
reviewed
Nov 20, 2025
men7627
reviewed
Nov 20, 2025
men7627
reviewed
Nov 20, 2025
로또 클래스의 가독성과 책임 분리를 위해 상수들을 companion object로 이동. 이를 통해 상수가 클래스 인스턴스와 무관한 공용 정보임을 명확히 표현. footer: 코드 정리 및 클래스 구조 개선.
예외 메시지에 상수를 활용하여 코드 중복을 제거하고 유지 보수성을 개선. 상수 값이 변경되더라도 메시지가 자동으로 반영되도록 처리. footer: 예외 처리 가독성 향상.
금액 검증 로직을 init 및 invoke로 분리하여 가독성과 재사용성을 향상. 에러 메시지 및 최소 금액 상수를 추가하여 코드 중복 제거 및 유지 보수성 개선. footer: 로직 재구성으로 유효성 검사 효율성 증가.
문자열 금액 입력 시 초기화 로직을 개선하고 중복된 검증 코드를 parseAndValidate 함수로 통합. init 블록과 생성자에서 최소 금액 상수를 활용하여 코드 간소화. footer: 코드 재사용성 및 유지 보수성 향상.
메서드의 동작과 의도를 더 명확히 표현하기 위해 buyLotto를 sellLotto로 리팩터링. 이에 따라 관련 호출부와 테스트 코드도 동일하게 수정. footer: 가독성 및 코드 일관성 강화.
Author
|
아앗. |
men7627
approved these changes
Nov 24, 2025
Comment on lines
+9
to
+28
| "문자가 포함된 경우 예외 발생" { | ||
| val exception = | ||
| shouldThrow<IllegalArgumentException> { WinLotto("1 2 3 4 5 육") } | ||
| exception.message shouldBe "올바른 숫자를 입력하세요" | ||
| } | ||
| "1보다 작거나 45보다 큰 숫자가 포함된 경우 예외 발생" { | ||
| val exception = | ||
| shouldThrow<IllegalArgumentException> { WinLotto("0 2 3 4 5 46") } | ||
| exception.message shouldBe "1부터 45까지의 숫자를 입력하세요" | ||
| } | ||
| "5개의 숫자를 입력하는 경우 예외 발생" { | ||
| val exception = | ||
| shouldThrow<IllegalArgumentException> { WinLotto("2 4 6 8 10") } | ||
| exception.message shouldBe "6개의 서로 다른 숫자를 입력하세요" | ||
| } | ||
| "6개 숫자 간 중복이 있는 경우" { | ||
| val exception = | ||
| shouldThrow<IllegalArgumentException> { WinLotto("2 4 6 8 10 2") } | ||
| exception.message shouldBe "6개의 서로 다른 숫자를 입력하세요" | ||
| } |
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.
💯
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.