Skip to content

Commit

Permalink
Merge pull request #79 from saessagMarket/fix/#77-productServiceTest-…
Browse files Browse the repository at this point in the history
…build-error

ProductService 테스트 코드 Mock 설정 추가
  • Loading branch information
ahyeonkong authored Feb 14, 2025
2 parents f55d11b + 3c81930 commit 2b8d5c7
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.market.saessag.domain.product.service;

import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyLong;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
Expand Down Expand Up @@ -41,6 +42,8 @@ void bumpProduct() {

when(productRepository.findById(anyLong()))
.thenReturn(Optional.of(product));
when(productRepository.save(any(Product.class)))
.thenReturn(product); // save에 대한 mock 동작 추가

// when
Product newProduct = productService.bumpProduct(product.getId(), user.getId());
Expand Down

0 comments on commit 2b8d5c7

Please sign in to comment.