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

[크리스마스] 코드 리뷰 부탁드립니다! #1

Open
wants to merge 51 commits into
base: review
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
8e1abb6
docs : 기능 요구사항 초안 정리
youngsu5582 Nov 11, 2023
5d4a71e
feat : 입출력 담당 하는 InputView,OutputView 추가
youngsu5582 Nov 11, 2023
199640c
feat : Parser , CustomException 추가
youngsu5582 Nov 11, 2023
78d259d
feat : Calendar , DayOfWeek 추가
youngsu5582 Nov 11, 2023
9674ca5
feat : Date 를 생성 하는 기능 추가
youngsu5582 Nov 11, 2023
ec5663b
feat : Category , Menu , MenuItem 추가
youngsu5582 Nov 11, 2023
10a9bad
feat : MenuCatalog 추가
youngsu5582 Nov 11, 2023
8a7f8b1
feat : RequestOrder 추가
youngsu5582 Nov 11, 2023
307c46e
feat : Order 추가
youngsu5582 Nov 12, 2023
eec9b9a
feat : OrderResult 추가 , MenuCatalog 함수 변경
youngsu5582 Nov 12, 2023
66303fe
feat : Bill 추가
youngsu5582 Nov 12, 2023
2b7addd
feat : DayOfWeek 에 함수 추가
youngsu5582 Nov 12, 2023
24930ab
feat : Event,DiscountEvent,PresentEvent 추가
youngsu5582 Nov 12, 2023
8e2d438
feat : Event,DiscountEvent,PresentEvent 제네릭 타입 추가
youngsu5582 Nov 12, 2023
0227308
feat : WeekendDiscountEvent 기능 추가
youngsu5582 Nov 12, 2023
4e8dc13
feat : WeekdayDiscountEvent,ChristmasDiscountEvent 추가
youngsu5582 Nov 12, 2023
7b950dd
feat : SpecialDiscountEvent,ChampagnePresentEvent 추가
youngsu5582 Nov 13, 2023
7d90095
feat : DiscountEventReward , PresentEventReward 추가
youngsu5582 Nov 13, 2023
8b5dfa8
feat : 기존 Event 리턴 타입 변경
youngsu5582 Nov 13, 2023
d9bd891
feat : EventReward 추가
youngsu5582 Nov 13, 2023
6883c9d
feat : 혜택을 모오는 Reward 추가
youngsu5582 Nov 13, 2023
8bfd238
feat : Badge 추가
youngsu5582 Nov 13, 2023
f5cf59d
feat : 방문할 날짜를 입력 하는 1번 기능 요구 사항 완료
youngsu5582 Nov 13, 2023
a23b4a1
feat : 주문할 메뉴와 메뉴 개수 입력 하는 2번 기능 요구 사항 완료
youngsu5582 Nov 13, 2023
6a1ad99
fix : 누락된 파일 추가
youngsu5582 Nov 13, 2023
5259f91
feat : 숫자 변환 해주는 Formatter 추가
youngsu5582 Nov 13, 2023
a28a077
feat : 적용 가능한 이벤트 혜택 적용 하는 3번 기능 요구 사항 완료
youngsu5582 Nov 13, 2023
55540fa
fix : 잘못 기입한 상수명 수정
youngsu5582 Nov 13, 2023
ed16c00
feat : 총 혜택 금액 따라 이벤트 뱃지 부여 하는 4번 기능 요구 사항 완료
youngsu5582 Nov 14, 2023
163e909
feat : 숫자에 따라 , 포맷 결정 하는 formatBasedOnNumber 추가
youngsu5582 Nov 14, 2023
f72430a
feat : 모든 기능 완료에 따른 Application 에 GameController 추가
youngsu5582 Nov 14, 2023
6b8c209
refactor : 에러 메시지 내용 변경 및 불필요한 파일 제거
youngsu5582 Nov 14, 2023
f33c8bc
refactor : 에러 메시지 내용 변경 , 구분자 상수 파일로 이동
youngsu5582 Nov 14, 2023
4a00ee2
refactor : 배열 생성중 , 반복문 구문 분리
youngsu5582 Nov 14, 2023
d67a2c7
feat : RewardDto getTotalDiscountReward 추가
youngsu5582 Nov 14, 2023
54276b0
feat : Date Service try - catch 문 추가
youngsu5582 Nov 14, 2023
e0d8cf1
refactor : 코드 전반 적인 리팩토링
youngsu5582 Nov 14, 2023
eba4437
refactor : Coverage 위한 불 필요한 코드 제거
youngsu5582 Nov 14, 2023
830c2b7
refactor : Date Domain 관련 리팩토링
youngsu5582 Nov 14, 2023
dbbd4fe
refactor : Order Domain 관련 리팩토링
youngsu5582 Nov 14, 2023
8e0860e
refactor : Event 파일들 Discount , Present 로 구분
youngsu5582 Nov 14, 2023
a955741
refactor : Event 이름 상수 파일로 이동
youngsu5582 Nov 14, 2023
39ac7eb
refactor : Domain 폴더 변경
youngsu5582 Nov 14, 2023
fbb42fc
refactor : import 구문 순서 변경
youngsu5582 Nov 14, 2023
48f694b
refactor : 제출 전 리팩토링
youngsu5582 Nov 14, 2023
a5c7c16
test : 테스트 케이스 추가
youngsu5582 Nov 14, 2023
0367681
feat : Event,Service,Controller Factory 추가
youngsu5582 Nov 15, 2023
562c727
test : 파일명 변경 및 테스트 코드 추가
youngsu5582 Nov 15, 2023
0a7415e
refactor : 테스트 함수명 변경 , 누락 함수 추가
youngsu5582 Nov 15, 2023
cfce5be
refactor : Test 내 Domain 파일 폴더별 분리
youngsu5582 Nov 15, 2023
ba73ffc
docs : 기능 전부 구현 후 README 상세 내용 추가
youngsu5582 Nov 15, 2023
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
Prev Previous commit
Next Next commit
test : 파일명 변경 및 테스트 코드 추가
기존 : EventList
변경 : InProgressEventList
EventList 는 Event 의 배열명 으로도 사용 가능
- 이벤트 목록 분리 하는 케이스 추가
  • Loading branch information
youngsu5582 committed Nov 15, 2023
commit 562c7279521bdae860086c6006d0dfe5f0d48534
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
import java.util.ArrayList;
import java.util.List;

public record EventList(List<DiscountEvent> discountEventList,
List<PresentEvent> presentEventList) {
public static EventList of(List<Event> eventList) {
public record InProgressEventList(List<DiscountEvent> discountEventList,
List<PresentEvent> presentEventList) {
public static InProgressEventList of(List<Event> eventList) {
List<DiscountEvent> discountEventList = new ArrayList<>();
List<PresentEvent> presentEventList = new ArrayList<>();
for (Event event : eventList) {
Expand All @@ -20,6 +20,6 @@ public static EventList of(List<Event> eventList) {
presentEventList.add((PresentEvent) event);
}
}

Choose a reason for hiding this comment

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

이 부분은 약간 개선할 수도 있을것 같습니다! 이 클래스의 of 메소드는 EventSercice 에서 EventFactory 의 static 변수인 EVENT_LIST 를 파라미터로 넣어서 생성하는 부분에서만 쓰이는데 EVENT_LIST 는 항상 같은 값을 가지는 변수로 예상됩니다. 그렇다면 처음부터 할인 이벤트와 증정 이벤트를 따로 관리하는 방법은 어떨까요?

Copy link
Owner Author

Choose a reason for hiding this comment

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

해당 코드는 이벤트가 할인 과 증정 이벤트 뿐 아니라 ,
특가 등 다른 종류의 이벤트가 생겨도 추가하기 쉽게 만들려고 했는데
생각해보니 , 그냥 DISCOUNT_EVENT_LIST , PRESENT_EVENT_LIST 처럼 나누는게 더 깔끔하겠네요!!
감사합니다! 👍

return new EventList(discountEventList, presentEventList);
return new InProgressEventList(discountEventList, presentEventList);
}
}
6 changes: 3 additions & 3 deletions src/main/java/christmas/service/EventService.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import java.util.stream.Stream;

import christmas.domain.date.Date;
import christmas.domain.event.EventList;
import christmas.domain.event.InProgressEventList;
import christmas.domain.reward.Reward;
import christmas.domain.order.Bill;

Expand All @@ -24,10 +24,10 @@
import static christmas.constant.EventConstant.EVENT_THRESHOLD_PRICE;

public class EventService {
private final EventList eventList;
private final InProgressEventList eventList;

public EventService() {
eventList = EventList.of(EventFactory.getEventList());
eventList = InProgressEventList.of(EventFactory.getEventList());
}

public Reward createReward(Date date, Bill bill) {
Expand Down
21 changes: 21 additions & 0 deletions src/test/java/christmas/domain/InProgressEventListTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package christmas.domain;

import christmas.domain.event.InProgressEventList;
import christmas.factory.EventFactory;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;

public class InProgressEventListTest {

@Test
@DisplayName("이벤트 목록 들을 , 할인 이벤트 와 증정 이벤트 로 분리 해서 InProgressEventList 를 만든다.")
void createInprogressListWithEventList() {
var eventList = EventFactory.getEventList();
InProgressEventList inProgressEventList = InProgressEventList.of(eventList);
var discountEventCount = inProgressEventList.discountEventList().size();
var presentEventCount = inProgressEventList.presentEventList().size();
Assertions.assertEquals(eventList.size(), discountEventCount + presentEventCount);
}
}