diff --git a/src/test/java/com/depromeet/breadmapbackend/domain/admin/bakery/service/AdminBakeryServiceTest.java b/src/test/java/com/depromeet/breadmapbackend/domain/admin/bakery/service/AdminBakeryServiceTest.java index d6d19c15..56ace16e 100644 --- a/src/test/java/com/depromeet/breadmapbackend/domain/admin/bakery/service/AdminBakeryServiceTest.java +++ b/src/test/java/com/depromeet/breadmapbackend/domain/admin/bakery/service/AdminBakeryServiceTest.java @@ -1,28 +1,5 @@ package com.depromeet.breadmapbackend.domain.admin.bakery.service; -import static org.assertj.core.api.Assertions.*; -import static org.mockito.ArgumentMatchers.*; -import static org.mockito.BDDMockito.*; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.Optional; - -import com.depromeet.breadmapbackend.domain.search.dto.keyword.BakeryLoadData; -import com.depromeet.breadmapbackend.domain.admin.bakery.handler.OpenSearchEventPublisher; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.mockito.ArgumentCaptor; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.junit.jupiter.MockitoExtension; -import org.springframework.context.ApplicationEventPublisher; - import com.depromeet.breadmapbackend.domain.admin.bakery.AdminBakeryServiceImpl; import com.depromeet.breadmapbackend.domain.admin.bakery.dto.AdminBakeryDto; import com.depromeet.breadmapbackend.domain.admin.bakery.dto.BakeryAddDto; @@ -39,6 +16,21 @@ import com.depromeet.breadmapbackend.domain.bakery.report.BakeryAddReportRepository; import com.depromeet.breadmapbackend.domain.user.User; import com.depromeet.breadmapbackend.global.infra.properties.CustomAWSS3Properties; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; + +import java.util.*; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.tuple; +import static org.mockito.ArgumentMatchers.*; +import static org.mockito.BDDMockito.*; @ExtendWith(MockitoExtension.class) public class AdminBakeryServiceTest { @@ -53,14 +45,10 @@ public class AdminBakeryServiceTest { private BakeryRepository bakeryRepository; @Mock private CustomAWSS3Properties customAWSS3Properties; - @Mock - private ApplicationEventPublisher eventPublisher; - @Mock - private OpenSearchEventPublisher openSearchEventPublisher; private List bakeries; private List products; - private CustomAWSS3Properties.DefaultImage defaultImage = new CustomAWSS3Properties.DefaultImage( + private final CustomAWSS3Properties.DefaultImage defaultImage = new CustomAWSS3Properties.DefaultImage( "bakery default image", "comment default image", "like default image", @@ -202,9 +190,6 @@ void after() { verify(bakeryRepository, times(1)) .existsByNameAndAddress(addRequest.getName(), addRequest.getAddress()); - ArgumentCaptor bakeryLoadDataCaptor = ArgumentCaptor.forClass(BakeryLoadData.class); - verify(openSearchEventPublisher).publishSaveBakery(bakeryLoadDataCaptor.capture()); - } @DisplayName("addBakery - 이미지 0개 등록 테스트") @@ -255,8 +240,6 @@ void after() { verify(bakeryRepository, times(1)) .existsByNameAndAddress(addRequest.getName(), addRequest.getAddress()); - ArgumentCaptor bakeryLoadDataCaptor = ArgumentCaptor.forClass(BakeryLoadData.class); - verify(openSearchEventPublisher).publishSaveBakery(bakeryLoadDataCaptor.capture()); } @DisplayName("updateBakery 테스트") @@ -317,9 +300,6 @@ void after() { "2023-08-2700:00:00", "update check point" ); - ArgumentCaptor bakeryLoadDataCaptor = ArgumentCaptor.forClass(BakeryLoadData.class); - verify(openSearchEventPublisher).publishSaveBakery(bakeryLoadDataCaptor.capture()); - } @DisplayName("updateBakery 테스트 - 수정 이미지가 0개일 경우 기본 이미지 1개를 삽입한다") @@ -364,8 +344,5 @@ void after() { assertThat(bakeries.get(0).getImages()).hasSize(1); assertThat(bakeries.get(0).getImages().get(0)).contains( customAWSS3Properties.getCloudFront() + "/" + customAWSS3Properties.getDefaultImage().getBakery()); - - ArgumentCaptor bakeryLoadDataCaptor = ArgumentCaptor.forClass(BakeryLoadData.class); - verify(openSearchEventPublisher).publishSaveBakery(bakeryLoadDataCaptor.capture()); } }