From 9e27bedeadd6c27ed9d8b509a02e9c140474130f Mon Sep 17 00:00:00 2001 From: subin Date: Mon, 1 Jul 2024 23:18:25 +0900 Subject: [PATCH] =?UTF-8?q?hotfix:=20=ED=8C=90=EB=A7=A4=EC=9E=90=20?= =?UTF-8?q?=EC=A3=BC=EB=AC=B8=20=EC=A1=B0=ED=9A=8C=20QueryDSL=20=EA=B4=80?= =?UTF-8?q?=EB=A0=A8=20=EC=98=A4=EB=A5=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../clothstar/order/entity/QOrderEntity.java | 2 -- .../controller/OrderSellerController.java | 5 +++-- .../order/service/OrderSellerService.java | 4 ++-- .../order/service/OrderSellerServiceTest.java | 20 +++++++++---------- 4 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/main/generated/org/store/clothstar/order/entity/QOrderEntity.java b/src/main/generated/org/store/clothstar/order/entity/QOrderEntity.java index 4daf95dc..da40f2d3 100644 --- a/src/main/generated/org/store/clothstar/order/entity/QOrderEntity.java +++ b/src/main/generated/org/store/clothstar/order/entity/QOrderEntity.java @@ -28,8 +28,6 @@ public class QOrderEntity extends EntityPathBase { public final org.store.clothstar.member.entity.QMemberEntity member; - public final ListPath orderDetails = this.createList("orderDetails", org.store.clothstar.orderDetail.entity.OrderDetailEntity.class, org.store.clothstar.orderDetail.entity.QOrderDetailEntity.class, PathInits.DIRECT2); - public final NumberPath orderId = createNumber("orderId", Long.class); public final EnumPath paymentMethod = createEnum("paymentMethod", org.store.clothstar.order.type.PaymentMethod.class); diff --git a/src/main/java/org/store/clothstar/order/controller/OrderSellerController.java b/src/main/java/org/store/clothstar/order/controller/OrderSellerController.java index 14929b8e..2655a4e1 100644 --- a/src/main/java/org/store/clothstar/order/controller/OrderSellerController.java +++ b/src/main/java/org/store/clothstar/order/controller/OrderSellerController.java @@ -7,6 +7,7 @@ import org.springframework.web.bind.annotation.*; import org.store.clothstar.common.dto.MessageDTO; import org.store.clothstar.order.dto.reponse.OrderResponse; +import org.store.clothstar.order.entity.OrderEntity; import org.store.clothstar.order.service.OrderSellerService; import java.util.List; @@ -21,8 +22,8 @@ public class OrderSellerController { @Operation(summary = "(판매자) WAITING 주문 리스트 조회", description = "(판매자) 주문상태가 '승인대기'인 주문 리스트를 조회한다.") @GetMapping - public ResponseEntity> getWaitingOrder() { - List orderResponseList = orderSellerService.getWaitingOrder(); + public ResponseEntity> getWaitingOrder() { + List orderResponseList = orderSellerService.getWaitingOrder(); return ResponseEntity.ok(orderResponseList); } diff --git a/src/main/java/org/store/clothstar/order/service/OrderSellerService.java b/src/main/java/org/store/clothstar/order/service/OrderSellerService.java index 0bd1de30..62c3e25d 100644 --- a/src/main/java/org/store/clothstar/order/service/OrderSellerService.java +++ b/src/main/java/org/store/clothstar/order/service/OrderSellerService.java @@ -7,6 +7,7 @@ import org.springframework.web.server.ResponseStatusException; import org.store.clothstar.common.dto.MessageDTO; import org.store.clothstar.order.dto.reponse.OrderResponse; +import org.store.clothstar.order.entity.OrderEntity; import org.store.clothstar.order.repository.order.OrderRepository; import org.store.clothstar.order.repository.orderSeller.JpaOrderSellerRepository; import org.store.clothstar.order.repository.orderSeller.OrderSellerRepository; @@ -35,10 +36,9 @@ public OrderSellerService( } @Transactional(readOnly = true) - public List getWaitingOrder() { + public List getWaitingOrder() { return orderSellerRepository.findWaitingOrders().stream() - .map(OrderResponse::fromOrderEntity) .collect(Collectors.toList()); } diff --git a/src/test/java/org/store/clothstar/order/service/OrderSellerServiceTest.java b/src/test/java/org/store/clothstar/order/service/OrderSellerServiceTest.java index f5688f34..d6417139 100644 --- a/src/test/java/org/store/clothstar/order/service/OrderSellerServiceTest.java +++ b/src/test/java/org/store/clothstar/order/service/OrderSellerServiceTest.java @@ -59,26 +59,26 @@ class OrderSellerServiceTest { void getWaitingOrder_test() { //given OrderEntity order1 = mock(OrderEntity.class); - given(order1.getCreatedAt()).willReturn(LocalDateTime.now()); +// given(order1.getCreatedAt()).willReturn(LocalDateTime.now()); given(order1.getTotalShippingPrice()).willReturn(1000); - given(order1.getMember()).willReturn(mockMemberEntity); - given(order1.getAddress()).willReturn(mockAddressEntity); +// given(order1.getMember()).willReturn(mockMemberEntity); +// given(order1.getAddress()).willReturn(mockAddressEntity); OrderEntity order2 = mock(OrderEntity.class); - given(order2.getCreatedAt()).willReturn(LocalDateTime.now()); - given(order2.getMember()).willReturn(mockMemberEntity); - given(order2.getAddress()).willReturn(mockAddressEntity); +// given(order2.getCreatedAt()).willReturn(LocalDateTime.now()); +// given(order2.getMember()).willReturn(mockMemberEntity); +// given(order2.getAddress()).willReturn(mockAddressEntity); OrderEntity order3 = mock(OrderEntity.class); - given(order3.getCreatedAt()).willReturn(LocalDateTime.now()); - given(order3.getMember()).willReturn(mockMemberEntity); - given(order3.getAddress()).willReturn(mockAddressEntity); +// given(order3.getCreatedAt()).willReturn(LocalDateTime.now()); +// given(order3.getMember()).willReturn(mockMemberEntity); +// given(order3.getAddress()).willReturn(mockAddressEntity); List orders = List.of(order1, order2, order3); given(orderSellerRepository.findWaitingOrders()).willReturn(orders); //when - List response = orderSellerService.getWaitingOrder(); + List response = orderSellerService.getWaitingOrder(); //then then(orderSellerRepository).should(times(1)).findWaitingOrders();