Skip to content

Commit

Permalink
[feature] CouponUseDaysType 관련 테스트 코드 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
tkddn204 committed Jan 27, 2024
1 parent ff45064 commit 8e17978
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
23 changes: 13 additions & 10 deletions src/test/java/com/coolpeace/docs/coupon/CouponControllerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.coolpeace.domain.coupon.dto.request.CouponRegisterRequest;
import com.coolpeace.domain.coupon.dto.request.CouponUpdateRequest;
import com.coolpeace.domain.coupon.dto.request.type.DtoCouponUseDayOfWeekType;
import com.coolpeace.domain.coupon.dto.request.type.DtoCouponUseDaysType;
import com.coolpeace.domain.coupon.dto.request.type.SearchCouponDateFilterType;
import com.coolpeace.domain.coupon.dto.request.type.SearchCouponStatusFilterType;
import com.coolpeace.domain.coupon.dto.response.CouponResponse;
Expand Down Expand Up @@ -114,7 +115,8 @@ void registerCoupon_success() throws Exception {
false,
randomRoomNumbers,
coupon.getMinimumReservationPrice(),
DtoCouponUtil.filteringCouponUseConditionDays(coupon.getCouponUseDays()).getValue(),
Optional.ofNullable(DtoCouponUtil.filteringCouponUseConditionDays(coupon.getCouponUseDays()))
.map(DtoCouponUseDaysType::getValue).orElse(null),
Optional.ofNullable(DtoCouponUtil.filteringCouponUseConditionDayOfWeek(coupon.getCouponUseDays()))
.map(DtoCouponUseDayOfWeekType::getValue).orElse(null),
coupon.getExposureStartDate(),
Expand Down Expand Up @@ -147,8 +149,8 @@ void registerCoupon_success() throws Exception {
fieldWithPath("accommodation_id").type(JsonFieldType.NUMBER).description("숙박업체의 ID"),
fieldWithPath("register_all_room").type(JsonFieldType.BOOLEAN).description("객실 등록 여부"),
fieldWithPath("register_rooms").type(JsonFieldType.ARRAY).description("등록될 객실의 리스트"),
fieldWithPath("minimum_reservation_price").type(JsonFieldType.NUMBER).description("최소 예약 가격"),
fieldWithPath("coupon_use_condition_days").type(JsonFieldType.STRING).description("쿠폰 사용 가능 일자"),
fieldWithPath("minimum_reservation_price").type(JsonFieldType.NUMBER).description("최소 예약 가격").optional(),
fieldWithPath("coupon_use_condition_days").type(JsonFieldType.STRING).description("쿠폰 사용 가능 일자").optional(),
fieldWithPath("coupon_use_condition_day_of_week").type(JsonFieldType.STRING).description("쿠폰 사용 가능 요일").optional(),
fieldWithPath("exposure_start_date").type(JsonFieldType.STRING).description("노출 시작 날짜"),
fieldWithPath("exposure_end_date").type(JsonFieldType.STRING).description("노출 종료 날짜")
Expand Down Expand Up @@ -211,8 +213,8 @@ void searchCoupon_success() throws Exception {
fieldWithPath("content[].maximum_discount_price").type(JsonFieldType.NUMBER).description("정률 할인일 때 최대 할인 한도").optional(),
fieldWithPath("content[].customer_type").type(JsonFieldType.STRING).description("고객의 유형"),
fieldWithPath("content[].coupon_room_types").type(JsonFieldType.ARRAY).description("객실의 유형"),
fieldWithPath("content[].minimum_reservation_price").type(JsonFieldType.NUMBER).description("최소 예약 가격"),
fieldWithPath("content[].coupon_use_condition_days").type(JsonFieldType.STRING).description("쿠폰 사용 가능 일자"),
fieldWithPath("content[].minimum_reservation_price").type(JsonFieldType.NUMBER).description("최소 예약 가격").optional(),
fieldWithPath("content[].coupon_use_condition_days").type(JsonFieldType.STRING).description("쿠폰 사용 가능 일자").optional(),
fieldWithPath("content[].coupon_use_condition_day_of_week").type(JsonFieldType.STRING).description("쿠폰 사용 가능 요일").optional(),
fieldWithPath("content[].exposure_start_date").type(JsonFieldType.STRING).description("노출 시작 날짜"),
fieldWithPath("content[].exposure_end_date").type(JsonFieldType.STRING).description("노출 종료 날짜"),
Expand Down Expand Up @@ -285,8 +287,8 @@ void getCouponRecentHistory_success() throws Exception {
fieldWithPath("[].maximum_discount_price").type(JsonFieldType.NUMBER).description("정률 할인일 때 최대 할인 한도").optional(),
fieldWithPath("[].customer_type").type(JsonFieldType.STRING).description("고객의 유형"),
fieldWithPath("[].coupon_room_types").type(JsonFieldType.ARRAY).description("객실의 유형"),
fieldWithPath("[].minimum_reservation_price").type(JsonFieldType.NUMBER).description("최소 예약 가격"),
fieldWithPath("[].coupon_use_condition_days").type(JsonFieldType.STRING).description("쿠폰 사용 가능 일자"),
fieldWithPath("[].minimum_reservation_price").type(JsonFieldType.NUMBER).description("최소 예약 가격").optional(),
fieldWithPath("[].coupon_use_condition_days").type(JsonFieldType.STRING).description("쿠폰 사용 가능 일자").optional(),
fieldWithPath("[].coupon_use_condition_day_of_week").type(JsonFieldType.STRING).description("쿠폰 사용 가능 요일").optional(),
fieldWithPath("[].exposure_start_date").type(JsonFieldType.STRING).description("노출 시작 날짜"),
fieldWithPath("[].exposure_end_date").type(JsonFieldType.STRING).description("노출 종료 날짜"),
Expand Down Expand Up @@ -361,8 +363,8 @@ void getCouponByCouponNumber_success() throws Exception {
fieldWithPath("maximum_discount_price").type(JsonFieldType.NUMBER).description("정률 할인일 때 최대 할인 한도").optional(),
fieldWithPath("customer_type").type(JsonFieldType.STRING).description("고객의 유형"),
fieldWithPath("coupon_room_types").type(JsonFieldType.ARRAY).description("객실의 유형"),
fieldWithPath("minimum_reservation_price").type(JsonFieldType.NUMBER).description("최소 예약 가격"),
fieldWithPath("coupon_use_condition_days").type(JsonFieldType.STRING).description("쿠폰 사용 가능 일자"),
fieldWithPath("minimum_reservation_price").type(JsonFieldType.NUMBER).description("최소 예약 가격").optional(),
fieldWithPath("coupon_use_condition_days").type(JsonFieldType.STRING).description("쿠폰 사용 가능 일자").optional(),
fieldWithPath("coupon_use_condition_day_of_week").type(JsonFieldType.STRING).description("쿠폰 사용 가능 요일").optional(),
fieldWithPath("exposure_start_date").type(JsonFieldType.STRING).description("노출 시작 날짜"),
fieldWithPath("exposure_end_date").type(JsonFieldType.STRING).description("노출 종료 날짜"),
Expand Down Expand Up @@ -400,7 +402,8 @@ void updateCoupon_success() throws Exception {
coupon.getCouponRooms().isEmpty(),
coupon.getCouponRooms().stream().map(room -> room.getRoom().getRoomNumber()).toList(),
coupon.getMinimumReservationPrice() + 10000,
DtoCouponUtil.filteringCouponUseConditionDays(coupon.getCouponUseDays()).getValue(),
Optional.ofNullable(DtoCouponUtil.filteringCouponUseConditionDays(coupon.getCouponUseDays()))
.map(DtoCouponUseDaysType::getValue).orElse(null),
Optional.ofNullable(DtoCouponUtil.filteringCouponUseConditionDayOfWeek(coupon.getCouponUseDays()))
.map(DtoCouponUseDayOfWeekType::getValue).orElse(null),
coupon.getExposureStartDate(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.coolpeace.domain.coupon.dto.request.CouponUpdateRequest;
import com.coolpeace.domain.coupon.dto.request.SearchCouponParams;
import com.coolpeace.domain.coupon.dto.request.type.DtoCouponUseDayOfWeekType;
import com.coolpeace.domain.coupon.dto.request.type.DtoCouponUseDaysType;
import com.coolpeace.domain.coupon.dto.request.type.SearchCouponDateFilterType;
import com.coolpeace.domain.coupon.dto.request.type.SearchCouponStatusFilterType;
import com.coolpeace.domain.coupon.dto.response.CouponResponse;
Expand Down Expand Up @@ -328,7 +329,8 @@ private CouponRegisterRequest getCouponRegisterRequest(boolean registerAllRoom)
registerAllRoom,
!registerAllRoom ? registerRoomNumbers : null,
coupon.getMinimumReservationPrice(),
DtoCouponUtil.filteringCouponUseConditionDays(coupon.getCouponUseDays()).getValue(),
Optional.ofNullable(DtoCouponUtil.filteringCouponUseConditionDays(coupon.getCouponUseDays()))
.map(DtoCouponUseDaysType::getValue).orElse(null),
Optional.ofNullable(DtoCouponUtil.filteringCouponUseConditionDayOfWeek(coupon.getCouponUseDays()))
.map(DtoCouponUseDayOfWeekType::getValue).orElse(null),
coupon.getExposureStartDate(),
Expand Down Expand Up @@ -400,7 +402,8 @@ void updateCoupon_mono_update_success() {
null,
null,
couponB.getMinimumReservationPrice(),
DtoCouponUtil.filteringCouponUseConditionDays(couponB.getCouponUseDays()).getValue(),
Optional.ofNullable(DtoCouponUtil.filteringCouponUseConditionDays(couponB.getCouponUseDays()))
.map(DtoCouponUseDaysType::getValue).orElse(null),
Optional.ofNullable(DtoCouponUtil.filteringCouponUseConditionDayOfWeek(couponB.getCouponUseDays()))
.map(DtoCouponUseDayOfWeekType::getValue).orElse(null),
couponB.getExposureStartDate(),
Expand Down

0 comments on commit 8e17978

Please sign in to comment.