From fb4b2d51765009edf4db78c514202aa099dc6c9b Mon Sep 17 00:00:00 2001 From: jaecheol sim Date: Fri, 15 Dec 2023 16:23:15 +0900 Subject: [PATCH] =?UTF-8?q?=20test:=20=EB=B0=94=EB=80=90=20cart=20api?= =?UTF-8?q?=EC=97=90=20=EC=9D=98=ED=95=9C=20test=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../reservation/unit/service/ReservationServiceTest.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/test/java/com/fc/shimpyo_be/domain/reservation/unit/service/ReservationServiceTest.java b/src/test/java/com/fc/shimpyo_be/domain/reservation/unit/service/ReservationServiceTest.java index e636709..43176f9 100644 --- a/src/test/java/com/fc/shimpyo_be/domain/reservation/unit/service/ReservationServiceTest.java +++ b/src/test/java/com/fc/shimpyo_be/domain/reservation/unit/service/ReservationServiceTest.java @@ -22,12 +22,14 @@ import com.fc.shimpyo_be.domain.room.entity.RoomPrice; import com.fc.shimpyo_be.domain.room.repository.RoomRepository; import com.fc.shimpyo_be.global.util.DateTimeUtil; +import com.fc.shimpyo_be.global.util.SecurityUtil; import lombok.extern.slf4j.Slf4j; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.context.annotation.Import; import java.time.LocalDate; @@ -40,6 +42,7 @@ import org.springframework.security.test.context.support.WithMockUser; import static org.assertj.core.api.Assertions.*; +import static org.mockito.BDDMockito.given; @Slf4j @Import(TestDBCleanerConfig.class) @@ -64,6 +67,9 @@ public class ReservationServiceTest extends AbstractContainersSupport { @Autowired private DatabaseCleanUp databaseCleanUp; + @MockBean + private SecurityUtil securityUtil; + private Member member; private final String[] tableNameArray = { @@ -90,6 +96,8 @@ void setUp() { .build() ); + given(securityUtil.getCurrentMemberId()).willReturn(member.getId()); + List products = new ArrayList<>(); for (int i = 1; i <= 3; i++) { String productName = "호텔" + i;