Skip to content
This repository has been archived by the owner on Aug 6, 2024. It is now read-only.

7회차 과제 PR #6

Open
wants to merge 1 commit into
base: chjih
Choose a base branch
from
Open

Conversation

chjih
Copy link

@chjih chjih commented Aug 14, 2022

No description provided.

Copy link
Collaborator

@findstar findstar left a 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) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

이것도 별도의 method 로 extract 할 수 있습니다.
그러면 비지니스 의미를 명확하게 할 수 있는 별도의 메소드 이름을 생성할 수 있죠 :)

Comment on lines 44 to +46
public void drawNumbers() {
for (int i = 0; i < number; i++) {
lotteryTickets.addLotteryTicket(numberStrategy);
for (int i = 0; i < number - manualNumber; i++) {
lotteryTickets.addAutoTicket(numberStrategy);
Copy link
Collaborator

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;
Copy link
Collaborator

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

Choose a reason for hiding this comment

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

🆗

Comment on lines +46 to +64
@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);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants