Skip to content

Conversation

@Delf-Lee
Copy link

No description provided.

@Delf-Lee Delf-Lee changed the base branch from master to delf January 19, 2020 07:24
@Delf-Lee Delf-Lee requested review from NESOY, doooyeon and gmlwjd9405 and removed request for NESOY and doooyeon January 19, 2020 07:24
}

public static Rank valueOf(int countOfMatch) {
public static Rank valueOf(int countOfMatch, boolean matchBonus) {
Copy link
Member

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) {
Copy link
Member

Choose a reason for hiding this comment

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

이 부분을 다른 Object로 리팩토링할 수 없을까요?
나중에 특정 조건이 추가되면 확장될 가능성이 높아보여서 그렇습니다ㅠ

Copy link
Author

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) {
Copy link
Member

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(
Copy link
Member

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);
Copy link
Member

Choose a reason for hiding this comment

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

모든 케이스에 대해 테스트를 작성하는게 의미가 있을까요?
나중에 로또 넘버가 100가지 되는 경우에 대해 모든 케이스를 테스트 하기 위해선 어떻게 작성해야할까요?

Copy link
Author

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) {
Copy link
Member

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()안의 로직과 이 메서드의 로직을 책임으로 가질 수 있을 것 같아요.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants