@GetMapping("/{memberId}/histories")
    public ResponseEntity<List<TradeHistoryResponse>> findTradeHistories(
            @PathVariable("memberId") final Long memberId,
            @AuthMember final Long authId,
            @RequestParam(value = "isSeller") final boolean isSeller
    ) {
        List<TradeHistoryResponse> response = memberService.findTradeHistories(memberId, authId, isSeller);
        return ResponseEntity.ok(response);
    }
@Test
    void 거래_내역을_조회한다() throws Exception {
        // given
        when(memberService.findTradeHistories(anyLong(), anyLong(), anyBoolean()))
                .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)
                        .queryParam("isSeller", String.valueOf(true))
                        .header(HttpHeaders.AUTHORIZATION, "Bearer tokenInfo~")
                ).andExpect(status().isOk())
                .andDo(customDocument("find_trade_histories",
                        requestHeaders(
                                headerWithName(AUTHORIZATION).description("유저 토큰 정보")
                        ),
                        queryParameters(
                                parameterWithName("isSeller").description("판매자인지 구매자인지 여부 (true = 판매자, false = 구매자)")
                        ),
                        responseFields(
                                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 타입으로 ',' 이용해서 묶음")
                        )
                ));
    }