-
Notifications
You must be signed in to change notification settings - Fork 4
Step2 #9
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
base: delf
Are you sure you want to change the base?
Step2 #9
Conversation
| } | ||
|
|
||
| public static Rank valueOf(int countOfMatch) { | ||
| public static Rank valueOf(int countOfMatch, boolean matchBonus) { |
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.
matchBouns와 같은 부분에 대해 전략으로 Refactoring할 수는 없을까요?
| public String toString() { | ||
| return String.format("%d개 일치 (%,d원)", countOfMatch, winningMoney); | ||
| String note = ""; | ||
| if (this == Rank.SECOND) { |
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.
이 부분을 다른 Object로 리팩토링할 수 없을까요?
나중에 특정 조건이 추가되면 확장될 가능성이 높아보여서 그렇습니다ㅠ
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.
저도 출력에 관한 책임을 따로 분리할 계획을 갖고 있었습니다ㅎㅎ 다음 스탭때 구현해보도록 하죠.
| private Lotto lotto; | ||
| private LottoNumber bonusNumber; | ||
|
|
||
| public WinningLotto(Lotto lotto, LottoNumber bonusNumber) { |
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.
WinningLotto와 BonusNumber는 종속적인 관계인가요?
|
|
||
| System.out.println("당첨 통계" + "\n" + "-------------"); | ||
| lottoStatistics.forEach(rank -> System.out.println( | ||
| /*lottoStatistics.forEach(rank -> System.out.println( |
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.
불필요한 주석은 제거해주세요 :)
| @Test | ||
| void noMatch() { | ||
| final Lotto userLotto = generateLotto(8, 9, 10, 11, 12, 13, 14); | ||
| assertThat(WINNING_LOTTO.match(userLotto)).isEqualTo(Rank.MISS); |
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.
모든 케이스에 대해 테스트를 작성하는게 의미가 있을까요?
나중에 로또 넘버가 100가지 되는 경우에 대해 모든 케이스를 테스트 하기 위해선 어떻게 작성해야할까요?
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.
의미있는 경곗값만 테스트하는걸 고려해볼 수 있겠네요
| private final static Rank[] PRINT_ORDER_RANK = {Rank.FIFTH, Rank.FOURTH, Rank.THIRD, /*Rank.SECOND, */Rank.FIRST}; | ||
|
|
||
| private Map<Rank, Integer> getCounter(Lotto winningLotto, LottoCollection lottoCollection) { | ||
| private Map<Rank, Integer> getCounter(WinningLotto winningLotto, LottoCollection lottoCollection) { |
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.
Map<Rank, Integer>을 추상화 하는 건 어떨까요?
Rank.RANK_COUNTER()안의 로직과 이 메서드의 로직을 책임으로 가질 수 있을 것 같아요.
No description provided.