Skip to content

Commit

Permalink
# fix: productService에서 securityUtil을 사용하기 위해 Mock설정을 해줌
Browse files Browse the repository at this point in the history
  • Loading branch information
wocjf0513 committed Dec 13, 2023
1 parent 9a4e3bc commit 00a419a
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@
import com.fc.shimpyo_be.domain.product.util.ProductMapper;
import com.fc.shimpyo_be.domain.room.dto.response.RoomResponse;
import com.fc.shimpyo_be.domain.room.entity.Room;
import com.fc.shimpyo_be.global.util.SecurityUtil;
import java.util.List;
import java.util.Optional;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks;
Expand All @@ -34,6 +36,9 @@
@ExtendWith(MockitoExtension.class)
class ProductServiceTest {

@Mock
private SecurityUtil securityUtil;

@Mock
private ProductRepository productRepository;

Expand All @@ -44,6 +49,10 @@ class ProductServiceTest {
@InjectMocks
private ProductService productService;

@BeforeEach
void init() {
given(securityUtil.getNullableCurrentMemberId()).willReturn(null);
}

@Test
void getProducts() {
Expand Down

0 comments on commit 00a419a

Please sign in to comment.