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

[2단계 - 로또(수동)] 연로그(권시연) 미션 제출합니다. #454

Merged
merged 27 commits into from
Mar 5, 2022
Merged
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
6d80ecb
docs: 리드미 갱신 - 요구사항 추가
Mar 2, 2022
820a506
refactor: LottoNumbers input 값의 최소한의 검증 View의 책임으로 변경
Mar 2, 2022
f7db213
style: 변수명 변경 number -> value
Mar 2, 2022
cf4410f
refactor: 인스턴스 캐싱 방식 변경
Mar 2, 2022
137b7c2
refactor: 하드코딩 제거, 형식 통일화
Mar 2, 2022
3b9694f
style: 우승 상금이 없는 경우 DEFULAT -> NONE 이름 변경
Mar 2, 2022
829c37d
test: given, when, then 구분
Mar 2, 2022
c71c797
refactor: LottoNumber의 접근제어자 private -> protected 변경
Mar 2, 2022
b7a65d2
feat: 수동 로또 개수 클래스 생성
Mar 2, 2022
ac8befc
feat: 수동 로또 입력 기능 구현
Mar 2, 2022
9f08b0c
feat: 수동 로또 개수 입력 기능 구현
Mar 2, 2022
964e57a
refactor: 하드코딩 제거
Mar 2, 2022
e45fd9e
style: 오류 문구 수정
Mar 2, 2022
7796450
refactor: 수동 구매 시 남은 횟수도 출력되도록 수정
Mar 2, 2022
dcd4bcd
docs: 리드미 갱신 - 구현 완료 기능 체크
Mar 2, 2022
de191ad
refactor: 티켓에 수동 로또 더하는 경우 LottoTicket 형태로 받도록 개선
Mar 4, 2022
3d94fe2
refactor: 정적 팩토리 메소드 도입
Mar 4, 2022
2701bcc
test: 테스트 케이스 수정
Mar 4, 2022
abb7362
test: given, when, then 분리
Mar 4, 2022
ecaba3c
test: findRanking 메소드 테스트 코드 추가
Mar 4, 2022
cb8cfb6
style: 1000단위 구분자 표시
Mar 4, 2022
4646a00
style: 메소드명 변경
Mar 4, 2022
affa474
refactor: equals(), hashCode() 재정의
Mar 5, 2022
293fe25
fix: 2등이 아닌데 보너스볼이 포함되는 경우 NONE으로 반환되는 현상 수정
Mar 5, 2022
581f834
refactor: findRanking() 메소드 분리
Mar 5, 2022
64660e7
style: 사용하지 않는 import 제거
Mar 5, 2022
6951fa8
fix: 3위가 반환되지 않는 현상 수정
Mar 5, 2022
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
7 changes: 5 additions & 2 deletions src/main/java/lotto/domain/Ranking.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,13 @@ public static Ranking findRanking(int count, boolean hasBonusNumber) {
}

private static boolean checkCountAndBonusNumber(Ranking ranking, int count, boolean hasBonusNumber) {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

슬랙에서 테스트 케이스를 하나 제시해주신 크루가 계셔서 로직을 다시 보게 되었어요
2등이 아니더라도 hasBonusNumber가 true로 들어오면 NONE으로 반환되는 현상을 개선했습니다

다만 앞으로도 hasBonusNumber가 true인 값들이 생길때마다 if문 처리해주는건 이상할 것 같아요
그렇다고 BiPredicate를 활용하자니 이미 count가 hasBonusNumber가 상수로 존재하는데 이를 활용하지 못하는게 아닐까? 라는 생각이 드네요
닉이라면 어떤 시도를 해보실 것 같나요?😂

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

음 그런데 현재 Rank 관련 테스트가 깨지고 있어서, 의도한대로 기능이 동작하지 않고 있어요.
한번 확인해주시고, 2등과 3등의 구분이 문제라면 2등을 ealry return 하는 방법도 한번 생각해보셔요 :)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 부분 체크를 누락됐네요💦 로직 개선했습니다!

if (count == 5) {
if (ranking.count != count) {
return false;
}
if (count == SECOND.getCount()) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (count == SECOND.getCount()) {
if (count == SECOND.count) {

해당 클래스 내의 로직이니 getter를 거치지 않아도 될 것 같아요 :)

return ranking.hasBonusNumber == hasBonusNumber;
}
return ranking.count == count;
return true;
}

public long multiple(Integer count) {
Expand Down