From 9ab12964484de51f96352a0b3f7c9292f4f2bb6c Mon Sep 17 00:00:00 2001 From: sosow0212 Date: Sat, 8 Jun 2024 20:00:12 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20productId=20=EB=B0=98=ED=99=98=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../member/domain/member/dto/TradeHistoryResponse.java | 1 + .../infrastructure/member/TradeHistoryFakeRepository.java | 1 + .../com/server/member/ui/member/MemberControllerTest.java | 8 ++------ 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/market-api/src/main/java/com/server/member/domain/member/dto/TradeHistoryResponse.java b/market-api/src/main/java/com/server/member/domain/member/dto/TradeHistoryResponse.java index d78444e..b690f69 100644 --- a/market-api/src/main/java/com/server/member/domain/member/dto/TradeHistoryResponse.java +++ b/market-api/src/main/java/com/server/member/domain/member/dto/TradeHistoryResponse.java @@ -4,6 +4,7 @@ public record TradeHistoryResponse( Long tradeHistoryId, String buyerName, String sellerName, + Long productId, String productTitle, int productOriginPrice, int productDiscountPrice, diff --git a/market-api/src/test/java/com/server/member/infrastructure/member/TradeHistoryFakeRepository.java b/market-api/src/test/java/com/server/member/infrastructure/member/TradeHistoryFakeRepository.java index 99a70fb..2c8811a 100644 --- a/market-api/src/test/java/com/server/member/infrastructure/member/TradeHistoryFakeRepository.java +++ b/market-api/src/test/java/com/server/member/infrastructure/member/TradeHistoryFakeRepository.java @@ -57,6 +57,7 @@ public List findHistories(final Long memberId, final boole it.getId(), "buyer", "seller", + 1L, "title", it.getProductOriginPrice(), it.getProductDiscountPrice(), diff --git a/market-api/src/test/java/com/server/member/ui/member/MemberControllerTest.java b/market-api/src/test/java/com/server/member/ui/member/MemberControllerTest.java index a590eb7..fdf0605 100644 --- a/market-api/src/test/java/com/server/member/ui/member/MemberControllerTest.java +++ b/market-api/src/test/java/com/server/member/ui/member/MemberControllerTest.java @@ -1,6 +1,5 @@ package com.server.member.ui.member; -import com.fasterxml.jackson.databind.ObjectMapper; import com.server.helper.MockBeanInjection; import com.server.market.domain.product.vo.Location; import com.server.market.domain.product.vo.ProductStatus; @@ -41,14 +40,11 @@ class MemberControllerTest extends MockBeanInjection { @Autowired private MockMvc mockMvc; - @Autowired - private ObjectMapper objectMapper; - @Test void 거래_내역을_조회한다() throws Exception { // given when(memberService.findTradeHistories(anyLong(), anyLong(), anyBoolean())) - .thenReturn(List.of(new TradeHistoryResponse(1L, "buyerNickname", "sellerNickname", "productTitle", 10000, 10, "1,2,3"))); + .thenReturn(List.of(new TradeHistoryResponse(1L, "buyerNickname", "sellerNickname", 1L, "productTitle", 10000, 10, "1,2,3"))); // when & then mockMvc.perform(get("/api/members/{memberId}/histories", 1L) @@ -66,11 +62,11 @@ class MemberControllerTest extends MockBeanInjection { fieldWithPath("[0].tradeHistoryId").description("거래 내역 id"), fieldWithPath("[0].buyerName").description("구매자 닉네임"), fieldWithPath("[0].sellerName").description("판매자 닉네임"), + fieldWithPath("[0].productId").description("상품 id"), fieldWithPath("[0].productTitle").description("상품 제목"), fieldWithPath("[0].productOriginPrice").description("상품 정상가"), fieldWithPath("[0].productDiscountPrice").description("상품 할인해서 구매한 가격"), fieldWithPath("[0].usingCouponIds").description("사용한 쿠폰 ids, String 타입으로 ',' 이용해서 묶음") - ) )); }