-
Notifications
You must be signed in to change notification settings - Fork 4
7회차 과제 PR #6
base: chjih
Are you sure you want to change the base?
7회차 과제 PR #6
Conversation
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 void validate() { | ||
if (number - manualNumber < 0) { |
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.
이것도 별도의 method 로 extract 할 수 있습니다.
그러면 비지니스 의미를 명확하게 할 수 있는 별도의 메소드 이름을 생성할 수 있죠 :)
public void drawNumbers() { | ||
for (int i = 0; i < number; i++) { | ||
lotteryTickets.addLotteryTicket(numberStrategy); | ||
for (int i = 0; i < number - manualNumber; i++) { | ||
lotteryTickets.addAutoTicket(numberStrategy); |
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.
자동만 처리한다면 메소드 이름을 바꿔볼 수도 있을것 같아요
@@ -5,12 +5,20 @@ | |||
import java.util.stream.Collectors; | |||
|
|||
public class LotteryTicket { | |||
private static final int NUMBER = 6; |
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.
👍
|
||
public void printLottoNumbers(String result) { | ||
System.out.println(result); | ||
} | ||
|
||
public void printNumber(int manual, int auto) { |
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 | ||
public void testManualNumber(){ | ||
LotteryMachine lotteryMachine = new LotteryMachine(); | ||
lotteryMachine.pay(1000); | ||
assertThatThrownBy(()-> lotteryMachine.setManualNumber(3)).isInstanceOf(IllegalArgumentException.class); | ||
} | ||
|
||
@DisplayName("수동로또 티켓이 올바르게 당첨 되는 지 확인") | ||
@Test | ||
public void testManualTicket(){ | ||
LotteryMachine lotteryMachine = new LotteryMachine(); | ||
lotteryMachine.pay(3000); | ||
lotteryMachine.setManualNumber(3); | ||
lotteryMachine.buyManualTicket(Arrays.asList("1, 2, 3, 4, 5, 6", | ||
"1, 3, 5, 7, 9, 11", "2, 4, 6, 8, 10, 12")); | ||
WinningStat stat = lotteryMachine.getStat(new WinningNumbers("1, 2, 3, 4, 5, 6", 7)); | ||
assertThat(stat.get(Prize.FIRST)).isEqualTo(1); | ||
} |
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.
👍
No description provided.