-
Notifications
You must be signed in to change notification settings - Fork 248
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: 로또 수동 수동 로또 생성 기능 구현완료 * refactor : LottoCount 의존성 약화(Money 제거) * refactor : 오탈자 수정 * refactor : LottoFactoryTest 리팩터링 * refactor : 피드백 반영 컨벤션에 맞게 띄어쓰기, 중괄호 수정 메서드, 변수명 명확하게 수정 LottoFactory 내의 메소드 makeManualLottos 추출, addAutoLotto 추출 * refactor : 피드백 반영 컨벤션에 맞게 띄어쓰기, 중괄호 수정 메서드, 변수명 명확하게 수정 LottoFactory 내의 메소드 makeManualLottos 추출, addAutoLotto 추출 * refactor : 2/29 피드백 반영 input parameter 명 ManualLotto로 수정 * refactor : 3/1 피드백 반영 Rank 의 isBonus메서드 리턴 방식 수정
- Loading branch information
Showing
18 changed files
with
286 additions
and
86 deletions.
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 { | ||
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.