-
Notifications
You must be signed in to change notification settings - Fork 248
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
[디디] 로또 수동 입력 #168
Merged
Merged
[디디] 로또 수동 입력 #168
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
d0aae32
feat: 로또 수동
fucct 6f1132e
refactor : LottoCount 의존성 약화(Money 제거)
fucct c4607af
refactor : 오탈자 수정
fucct 65f73c8
refactor : LottoFactoryTest 리팩터링
fucct 080664c
refactor : 피드백 반영
fucct d73a3c7
refactor : 피드백 반영
fucct f6085be
refactor : 2/29 피드백 반영
fucct 43f275a
refactor : 3/1 피드백 반영
fucct 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package lotto.domain; | ||
|
||
import lotto.exception.ExceedMoneyException; | ||
import lotto.util.StringUtil; | ||
|
||
public class LottoCount { | ||
private final int manualLotto; | ||
private final int autoLotto; | ||
|
||
public LottoCount(String manualLotto, int totalLotto) { | ||
validate(manualLotto); | ||
validateMoney(manualLotto, totalLotto); | ||
this.manualLotto = Integer.parseInt(manualLotto); | ||
this.autoLotto = totalLotto - this.manualLotto; | ||
} | ||
|
||
private void validate(String ManualLotto) { | ||
StringUtil.checkNull(ManualLotto); | ||
StringUtil.checkBlank(ManualLotto); | ||
StringUtil.checkNumberFormat(ManualLotto); | ||
StringUtil.checkRange(ManualLotto); | ||
} | ||
|
||
private void validateMoney(String input, int totalLotto) { | ||
if (totalLotto < Integer.parseInt(input)) { | ||
throw new ExceedMoneyException(totalLotto + "장 이하만 구매가 가능합니다."); | ||
} | ||
} | ||
|
||
public int getManualLottoCount() { | ||
return manualLotto; | ||
} | ||
|
||
public int getAutoLottoCount() { | ||
return autoLotto; | ||
} | ||
} |
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package lotto.domain.result; | ||
|
||
public class Count { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 이 클래스는 왜 추가되었을까요..? |
||
private int count = 0; | ||
|
||
public void addCount() { | ||
count++; | ||
} | ||
|
||
public int getCount() { | ||
return count; | ||
} | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package lotto.exception; | ||
|
||
public class EmptyInputException extends RuntimeException { | ||
public EmptyInputException(String message) { | ||
super(message); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package lotto.exception; | ||
|
||
public class ExceedMoneyException extends RuntimeException { | ||
public ExceedMoneyException(String message) { | ||
super(message); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package lotto.exception; | ||
|
||
public class InvalidRangeException extends RuntimeException { | ||
public InvalidRangeException(String message) { | ||
super(message); | ||
} | ||
} |
Oops, something went wrong.
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.
input
을 더 의미있는 이름으로 바꿔보면 좋을 듯 합니다.