diff --git a/src/test/java/com/backoffice/upjuyanolja/domain/accommodation/unit/service/AccommodationCommandServiceTest.java b/src/test/java/com/backoffice/upjuyanolja/domain/accommodation/unit/service/AccommodationCommandServiceTest.java index ad560c64..8359a27e 100644 --- a/src/test/java/com/backoffice/upjuyanolja/domain/accommodation/unit/service/AccommodationCommandServiceTest.java +++ b/src/test/java/com/backoffice/upjuyanolja/domain/accommodation/unit/service/AccommodationCommandServiceTest.java @@ -21,7 +21,7 @@ import com.backoffice.upjuyanolja.domain.accommodation.service.AccommodationCommandService; import com.backoffice.upjuyanolja.domain.member.entity.Authority; import com.backoffice.upjuyanolja.domain.member.entity.Member; -import com.backoffice.upjuyanolja.domain.member.service.MemberGetService; +import com.backoffice.upjuyanolja.domain.member.service.MemberQueryService; import com.backoffice.upjuyanolja.domain.room.dto.request.RoomImageRequest; import com.backoffice.upjuyanolja.domain.room.dto.request.RoomOptionRequest; import com.backoffice.upjuyanolja.domain.room.dto.request.RoomRegisterRequest; @@ -50,7 +50,7 @@ public class AccommodationCommandServiceTest { private AccommodationCommandService accommodationCommandService; @Mock - private MemberGetService memberGetService; + private MemberQueryService memberQueryService; @Mock private AccommodationRepository accommodationRepository; @@ -193,7 +193,7 @@ void _willSuccess() { .build()) .build(); - given(memberGetService.getMemberById(any(Long.TYPE))).willReturn(member); + given(memberQueryService.getMemberById(any(Long.TYPE))).willReturn(member); given(categoryRepository.findByName(any(String.class))) .willReturn(Optional.of(category)); given(accommodationRepository.save(any(Accommodation.class))).willReturn(accommodation); diff --git a/src/test/java/com/backoffice/upjuyanolja/domain/accommodation/unit/service/AccommodationQueryServiceTest.java b/src/test/java/com/backoffice/upjuyanolja/domain/accommodation/unit/service/AccommodationQueryServiceTest.java index aff333ce..d475609b 100644 --- a/src/test/java/com/backoffice/upjuyanolja/domain/accommodation/unit/service/AccommodationQueryServiceTest.java +++ b/src/test/java/com/backoffice/upjuyanolja/domain/accommodation/unit/service/AccommodationQueryServiceTest.java @@ -12,7 +12,7 @@ import com.backoffice.upjuyanolja.domain.accommodation.service.AccommodationQueryService; import com.backoffice.upjuyanolja.domain.member.entity.Authority; import com.backoffice.upjuyanolja.domain.member.entity.Member; -import com.backoffice.upjuyanolja.domain.member.service.MemberGetService; +import com.backoffice.upjuyanolja.domain.member.service.MemberQueryService; import java.util.List; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Nested; @@ -31,7 +31,7 @@ public class AccommodationQueryServiceTest { private AccommodationQueryService accommodationQueryService; @Mock - private MemberGetService memberGetService; + private MemberQueryService memberQueryService; @Mock private AccommodationOwnershipRepository accommodationOwnershipRepository; @@ -74,7 +74,7 @@ void _willSuccess() { .member(member) .build(); - given(memberGetService.getMemberById(any(Long.TYPE))).willReturn(member); + given(memberQueryService.getMemberById(any(Long.TYPE))).willReturn(member); given(accommodationOwnershipRepository.findAllByMember(any(Member.class))) .willReturn(List.of(accommodationOwnership)); diff --git a/src/test/java/com/backoffice/upjuyanolja/domain/coupon/docs/CouponBackofficeControllerDocsTest.java b/src/test/java/com/backoffice/upjuyanolja/domain/coupon/docs/CouponBackofficeControllerDocsTest.java index cacac83b..4b8a185f 100644 --- a/src/test/java/com/backoffice/upjuyanolja/domain/coupon/docs/CouponBackofficeControllerDocsTest.java +++ b/src/test/java/com/backoffice/upjuyanolja/domain/coupon/docs/CouponBackofficeControllerDocsTest.java @@ -48,7 +48,7 @@ import com.backoffice.upjuyanolja.domain.member.dto.response.MemberInfoResponse; import com.backoffice.upjuyanolja.domain.member.entity.Authority; import com.backoffice.upjuyanolja.domain.member.entity.Member; -import com.backoffice.upjuyanolja.domain.member.service.MemberGetService; +import com.backoffice.upjuyanolja.domain.member.service.MemberQueryService; import com.backoffice.upjuyanolja.domain.room.entity.Room; import com.backoffice.upjuyanolja.domain.room.entity.RoomStatus; import com.backoffice.upjuyanolja.global.security.SecurityUtil; @@ -76,7 +76,7 @@ class CouponBackofficeControllerDocsTest extends RestDocsSupport { private SecurityUtil securityUtil; @MockBean - private MemberGetService memberGetService; + private MemberQueryService memberQueryService; @MockBean private CouponBackofficeService couponBackofficeService; @@ -145,7 +145,7 @@ public void createCouponResponseTest() throws Exception { public void createCouponRequestTest() throws Exception { // given when(securityUtil.getCurrentMemberId()).thenReturn(1L); - when(memberGetService.getMemberById(1L)).thenReturn(mockMember); + when(memberQueryService.getMemberById(1L)).thenReturn(mockMember); List mockRequests = List.of( new CouponRoomsRequest(1L, DiscountType.FLAT, 5000, 10, 10000), @@ -210,7 +210,7 @@ public void createCouponRequestTest() throws Exception { public void manageCouponResponseTest() throws Exception { // given when(securityUtil.getCurrentMemberId()).thenReturn(1L); - when(memberGetService.getMemberById(1L)).thenReturn(mockMember); + when(memberQueryService.getMemberById(1L)).thenReturn(mockMember); Accommodation mockAccommodation = createAccommodation(1L); List roomIdSet = List.of(1L, 2L, 3L); @@ -296,7 +296,7 @@ public void manageCouponResponseTest() throws Exception { public void addonCouponRequestTest() throws Exception { // given when(securityUtil.getCurrentMemberId()).thenReturn(1L); - when(memberGetService.getMemberById(1L)).thenReturn(mockMember); + when(memberQueryService.getMemberById(1L)).thenReturn(mockMember); List rooms = createMockAddCoupons(); CouponAddRequest mockCouponAddRequest = new CouponAddRequest( @@ -382,7 +382,7 @@ public void addonCouponRequestTest() throws Exception { public void modifyCouponRequestTest() throws Exception { // given when(securityUtil.getCurrentMemberId()).thenReturn(1L); - when(memberGetService.getMemberById(1L)).thenReturn(mockMember); + when(memberQueryService.getMemberById(1L)).thenReturn(mockMember); List rooms = createMockModifyCoupons(); CouponModifyRequest mockCouponModifyRequest = new CouponModifyRequest( @@ -453,7 +453,7 @@ public void modifyCouponRequestTest() throws Exception { public void deleteCouponRequestTest() throws Exception { // given when(securityUtil.getCurrentMemberId()).thenReturn(1L); - when(memberGetService.getMemberById(1L)).thenReturn(mockMember); + when(memberQueryService.getMemberById(1L)).thenReturn(mockMember); List rooms = createMockDeleteCoupons(); CouponDeleteRequest mockDeleteRequest = new CouponDeleteRequest( @@ -499,7 +499,7 @@ public void deleteCouponRequestTest() throws Exception { public void couponStatisticsTest() throws Exception { // given when(securityUtil.getCurrentMemberId()).thenReturn(1L); - when(memberGetService.getMemberById(1L)).thenReturn(mockMember); + when(memberQueryService.getMemberById(1L)).thenReturn(mockMember); // when & Then CouponStatisticsResponse mockResponse = createMockStatisticsResponse(); @@ -540,7 +540,7 @@ public void revenueStatisticsTest() throws Exception { .build(); given(securityUtil.getCurrentMemberId()).willReturn(1L); - given(memberGetService.getMember(any(Long.TYPE))).willReturn(memberInfoResponse); + given(memberQueryService.getMember(any(Long.TYPE))).willReturn(memberInfoResponse); String mockName = mockMember.getName(); // when & Then diff --git a/src/test/java/com/backoffice/upjuyanolja/domain/coupon/unit/controller/CouponBackofficeControllerTest.java b/src/test/java/com/backoffice/upjuyanolja/domain/coupon/unit/controller/CouponBackofficeControllerTest.java index 57e2665b..b48cb8c0 100644 --- a/src/test/java/com/backoffice/upjuyanolja/domain/coupon/unit/controller/CouponBackofficeControllerTest.java +++ b/src/test/java/com/backoffice/upjuyanolja/domain/coupon/unit/controller/CouponBackofficeControllerTest.java @@ -46,7 +46,7 @@ import com.backoffice.upjuyanolja.domain.member.dto.response.MemberInfoResponse; import com.backoffice.upjuyanolja.domain.member.entity.Authority; import com.backoffice.upjuyanolja.domain.member.entity.Member; -import com.backoffice.upjuyanolja.domain.member.service.MemberGetService; +import com.backoffice.upjuyanolja.domain.member.service.MemberQueryService; import com.backoffice.upjuyanolja.domain.point.entity.Point; import com.backoffice.upjuyanolja.domain.room.entity.Room; import com.backoffice.upjuyanolja.domain.room.entity.RoomStatus; @@ -99,7 +99,7 @@ class CouponBackofficeControllerTest { private SecurityUtil securityUtil; @MockBean - private MemberGetService memberGetService; + private MemberQueryService memberQueryService; Member mockMember; @@ -121,7 +121,7 @@ class Context_makeCouponViewResponse { public void couponMakeViewResponse_test() throws Exception { // given when(securityUtil.getCurrentMemberId()).thenReturn(1L); - when(memberGetService.getMemberById(1L)).thenReturn(mockMember); + when(memberQueryService.getMemberById(1L)).thenReturn(mockMember); Long accommodationId = 1L; CouponMakeViewResponse makeViewResponse = makeCouponViewResponse(); @@ -149,7 +149,7 @@ public void couponMakeViewResponse_test() throws Exception { public void couponMakeRequestTest() throws Exception { // given when(securityUtil.getCurrentMemberId()).thenReturn(1L); - when(memberGetService.getMemberById(1L)).thenReturn(mockMember); + when(memberQueryService.getMemberById(1L)).thenReturn(mockMember); List mockCouponRoomsRequests = createCouponRooms(); CouponMakeRequest mockCouponMakeRequest = createCouponMakeRequest( @@ -177,7 +177,7 @@ class Context_couponManage { public void couponManageViewResponse_test() throws Exception { // given when(securityUtil.getCurrentMemberId()).thenReturn(1L); - when(memberGetService.getMemberById(1L)).thenReturn(mockMember); + when(memberQueryService.getMemberById(1L)).thenReturn(mockMember); List roomIdSet = List.of(1L, 2L, 3L); List roomNameSet = List.of("스탠다드", "디럭스", "스위트"); @@ -246,7 +246,7 @@ public void couponManageViewResponse_test() throws Exception { public void addonCouponTest() throws Exception { // given when(securityUtil.getCurrentMemberId()).thenReturn(1L); - when(memberGetService.getMemberById(1L)).thenReturn(mockMember); + when(memberQueryService.getMemberById(1L)).thenReturn(mockMember); List rooms = createMockAddCoupons(); CouponAddRequest couponAddRequest = new CouponAddRequest( @@ -266,7 +266,7 @@ public void addonCouponTest() throws Exception { public void couponModifyTest() throws Exception { // given when(securityUtil.getCurrentMemberId()).thenReturn(1L); - when(memberGetService.getMemberById(1L)).thenReturn(mockMember); + when(memberQueryService.getMemberById(1L)).thenReturn(mockMember); List rooms = createModifyCouponMock(); CouponModifyRequest couponModifyRequest = new CouponModifyRequest( @@ -286,7 +286,7 @@ public void couponModifyTest() throws Exception { public void couponDeleteTest() throws Exception { // given when(securityUtil.getCurrentMemberId()).thenReturn(1L); - when(memberGetService.getMemberById(1L)).thenReturn(mockMember); + when(memberQueryService.getMemberById(1L)).thenReturn(mockMember); List rooms = createMockDeleteRooms(); CouponDeleteRequest mockDeleteRequest = new CouponDeleteRequest( @@ -311,7 +311,7 @@ class Context_couponStatisticse { public void couponStatisticsTest() throws Exception { // given when(securityUtil.getCurrentMemberId()).thenReturn(1L); - when(memberGetService.getMemberById(1L)).thenReturn(mockMember); + when(memberQueryService.getMemberById(1L)).thenReturn(mockMember); // when & Then CouponStatisticsResponse mockResponse = createMockStatisticsResponse(); @@ -345,7 +345,7 @@ public void revenueStatisticsTest() throws Exception { .build(); given(securityUtil.getCurrentMemberId()).willReturn(1L); - given(memberGetService.getMember(any(Long.TYPE))).willReturn(memberInfoResponse); + given(memberQueryService.getMember(any(Long.TYPE))).willReturn(memberInfoResponse); String mockName = mockMember.getName(); // when & Then diff --git a/src/test/java/com/backoffice/upjuyanolja/domain/coupon/unit/service/CouponBackofficeServiceTest.java b/src/test/java/com/backoffice/upjuyanolja/domain/coupon/unit/service/CouponBackofficeServiceTest.java index 16c48f8a..86462d2f 100644 --- a/src/test/java/com/backoffice/upjuyanolja/domain/coupon/unit/service/CouponBackofficeServiceTest.java +++ b/src/test/java/com/backoffice/upjuyanolja/domain/coupon/unit/service/CouponBackofficeServiceTest.java @@ -15,7 +15,7 @@ import com.backoffice.upjuyanolja.domain.coupon.service.CouponBackofficeService; import com.backoffice.upjuyanolja.domain.member.entity.Authority; import com.backoffice.upjuyanolja.domain.member.entity.Member; -import com.backoffice.upjuyanolja.domain.member.service.MemberGetService; +import com.backoffice.upjuyanolja.domain.member.service.MemberQueryService; import com.backoffice.upjuyanolja.domain.point.entity.Point; import com.backoffice.upjuyanolja.domain.point.repository.PointRepository; import com.backoffice.upjuyanolja.domain.room.entity.Room; @@ -40,7 +40,7 @@ class CouponBackofficeServiceTest { CouponBackofficeService couponBackofficeService; @Mock - MemberGetService memberGetService; + MemberQueryService memberQueryService; @Mock CouponRepository couponRepository; diff --git a/src/test/java/com/backoffice/upjuyanolja/domain/member/docs/MemberAuthControllerDocsTest.java b/src/test/java/com/backoffice/upjuyanolja/domain/member/docs/MemberAuthControllerDocsTest.java index 54d48c0a..ecdb82f6 100644 --- a/src/test/java/com/backoffice/upjuyanolja/domain/member/docs/MemberAuthControllerDocsTest.java +++ b/src/test/java/com/backoffice/upjuyanolja/domain/member/docs/MemberAuthControllerDocsTest.java @@ -10,12 +10,11 @@ import static org.springframework.restdocs.payload.PayloadDocumentation.requestFields; import static org.springframework.restdocs.payload.PayloadDocumentation.responseFields; -import com.backoffice.upjuyanolja.domain.accommodation.service.AccommodationQueryService; import com.backoffice.upjuyanolja.domain.member.dto.request.EmailRequest; import com.backoffice.upjuyanolja.domain.member.dto.response.CheckEmailDuplicateResponse; import com.backoffice.upjuyanolja.domain.member.dto.response.MemberInfoResponse; import com.backoffice.upjuyanolja.domain.member.service.MemberAuthService; -import com.backoffice.upjuyanolja.domain.member.service.MemberGetService; +import com.backoffice.upjuyanolja.domain.member.service.MemberQueryService; import com.backoffice.upjuyanolja.global.security.SecurityUtil; import com.backoffice.upjuyanolja.global.util.RestDocsSupport; import org.junit.jupiter.api.DisplayName; @@ -32,7 +31,7 @@ public class MemberAuthControllerDocsTest extends RestDocsSupport { private MemberAuthService memberAuthService; @MockBean - private MemberGetService memberGetService; + private MemberQueryService memberQueryService; @MockBean private SecurityUtil securityUtil; @@ -78,7 +77,7 @@ void getMember() throws Exception { .build(); given(securityUtil.getCurrentMemberId()).willReturn(1L); - given(memberGetService.getMember(any(Long.TYPE))) + given(memberQueryService.getMember(any(Long.TYPE))) .willReturn(memberInfoResponse); // when then @@ -96,6 +95,6 @@ void getMember() throws Exception { ) )); - verify(memberGetService, times(1)).getMember(any(Long.TYPE)); + verify(memberQueryService, times(1)).getMember(any(Long.TYPE)); } } \ No newline at end of file diff --git a/src/test/java/com/backoffice/upjuyanolja/domain/member/unit/controller/MemberAuthControllerTest.java b/src/test/java/com/backoffice/upjuyanolja/domain/member/unit/controller/MemberAuthControllerTest.java index 3ccb3851..33edd38f 100644 --- a/src/test/java/com/backoffice/upjuyanolja/domain/member/unit/controller/MemberAuthControllerTest.java +++ b/src/test/java/com/backoffice/upjuyanolja/domain/member/unit/controller/MemberAuthControllerTest.java @@ -15,7 +15,7 @@ import com.backoffice.upjuyanolja.domain.member.dto.response.CheckEmailDuplicateResponse; import com.backoffice.upjuyanolja.domain.member.dto.response.MemberInfoResponse; import com.backoffice.upjuyanolja.domain.member.service.MemberAuthService; -import com.backoffice.upjuyanolja.domain.member.service.MemberGetService; +import com.backoffice.upjuyanolja.domain.member.service.MemberQueryService; import com.backoffice.upjuyanolja.global.security.AuthenticationConfig; import com.backoffice.upjuyanolja.global.security.SecurityUtil; import com.fasterxml.jackson.databind.ObjectMapper; @@ -51,7 +51,7 @@ public class MemberAuthControllerTest { private MemberAuthService memberAuthService; @MockBean - private MemberGetService memberGetService; + private MemberQueryService memberQueryService; @MockBean private SecurityUtil securityUtil; @@ -127,7 +127,7 @@ void _willSuccess() throws Exception { .build(); given(securityUtil.getCurrentMemberId()).willReturn(1L); - given(memberGetService.getMember(any(Long.TYPE))) + given(memberQueryService.getMember(any(Long.TYPE))) .willReturn(memberInfoResponse); // when then @@ -139,7 +139,7 @@ void _willSuccess() throws Exception { .andExpect(jsonPath("$.phoneNumber").isString()) .andDo(print()); - verify(memberGetService, times(1)).getMember(any(Long.class)); + verify(memberQueryService, times(1)).getMember(any(Long.class)); } } } \ No newline at end of file diff --git a/src/test/java/com/backoffice/upjuyanolja/domain/member/unit/service/MemberGetServiceTest.java b/src/test/java/com/backoffice/upjuyanolja/domain/member/unit/service/MemberQueryServiceTest.java similarity index 91% rename from src/test/java/com/backoffice/upjuyanolja/domain/member/unit/service/MemberGetServiceTest.java rename to src/test/java/com/backoffice/upjuyanolja/domain/member/unit/service/MemberQueryServiceTest.java index 5c4fe672..668d5539 100644 --- a/src/test/java/com/backoffice/upjuyanolja/domain/member/unit/service/MemberGetServiceTest.java +++ b/src/test/java/com/backoffice/upjuyanolja/domain/member/unit/service/MemberQueryServiceTest.java @@ -13,7 +13,7 @@ import com.backoffice.upjuyanolja.domain.member.entity.Member; import com.backoffice.upjuyanolja.domain.member.exception.MemberNotFoundException; import com.backoffice.upjuyanolja.domain.member.repository.MemberRepository; -import com.backoffice.upjuyanolja.domain.member.service.MemberGetService; +import com.backoffice.upjuyanolja.domain.member.service.MemberQueryService; import java.util.Optional; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Nested; @@ -26,10 +26,10 @@ @Transactional @ExtendWith(MockitoExtension.class) -public class MemberGetServiceTest { +public class MemberQueryServiceTest { @InjectMocks - private MemberGetService memberGetService; + private MemberQueryService memberQueryService; @Mock private MemberRepository memberRepository; @@ -55,7 +55,7 @@ void _willSuccess() { given(memberRepository.findById(any(Long.TYPE))).willReturn(Optional.of(member)); // when - MemberInfoResponse result = memberGetService.getMember(1L); + MemberInfoResponse result = memberQueryService.getMember(1L); // then assertThat(result.memberId()).isEqualTo(1L); @@ -74,7 +74,7 @@ void memberNotFound_willFail() { // when Throwable exception = assertThrows(MemberNotFoundException.class, () -> { - memberGetService.getMember(1L); + memberQueryService.getMember(1L); }); // then diff --git a/src/test/java/com/backoffice/upjuyanolja/domain/reservation/docs/ReservationControllerDocsTest.java b/src/test/java/com/backoffice/upjuyanolja/domain/reservation/docs/ReservationControllerDocsTest.java index 91bcdad2..67b087d9 100644 --- a/src/test/java/com/backoffice/upjuyanolja/domain/reservation/docs/ReservationControllerDocsTest.java +++ b/src/test/java/com/backoffice/upjuyanolja/domain/reservation/docs/ReservationControllerDocsTest.java @@ -19,7 +19,7 @@ import com.backoffice.upjuyanolja.domain.accommodation.entity.Category; import com.backoffice.upjuyanolja.domain.member.entity.Authority; import com.backoffice.upjuyanolja.domain.member.entity.Member; -import com.backoffice.upjuyanolja.domain.member.service.MemberGetService; +import com.backoffice.upjuyanolja.domain.member.service.MemberQueryService; import com.backoffice.upjuyanolja.domain.payment.entity.PayMethod; import com.backoffice.upjuyanolja.domain.payment.entity.Payment; import com.backoffice.upjuyanolja.domain.reservation.dto.request.CreateReservationRequest; @@ -62,7 +62,7 @@ public class ReservationControllerDocsTest extends RestDocsSupport { private SecurityUtil securityUtil; @MockBean - private MemberGetService memberGetService; + private MemberQueryService memberQueryService; @MockBean private ReservationService reservationService; @@ -208,7 +208,7 @@ void createReservation() throws Exception { //given CreateReservationRequest request = createRequest(null); when(securityUtil.getCurrentMemberId()).thenReturn(1L); - when(memberGetService.getMemberById(1L)).thenReturn(mockMember); + when(memberQueryService.getMemberById(1L)).thenReturn(mockMember); doNothing().when(reservationService).create(any(Member.class), eq(request)); //when @@ -262,7 +262,7 @@ void cancelReservation() throws Exception { // given Long reservationId = 1L; when(securityUtil.getCurrentMemberId()).thenReturn(1L); - when(memberGetService.getMemberById(1L)).thenReturn(mockMember); + when(memberQueryService.getMemberById(1L)).thenReturn(mockMember); doNothing().when(reservationService).cancel(any(Member.class), any(Long.class)); // when @@ -311,7 +311,7 @@ void getReserved() throws Exception { GetReservedResponse mockResponse = new GetReservedResponse(mockPage, mockPayments); when(securityUtil.getCurrentMemberId()).thenReturn(1L); - when(memberGetService.getMemberById(1L)).thenReturn(mockMember); + when(memberQueryService.getMemberById(1L)).thenReturn(mockMember); when(reservationService.getReserved(any(Member.class), eq(pageable))) .thenReturn(mockResponse); @@ -381,7 +381,7 @@ void getCanceled() throws Exception { GetCanceledResponse mockResponse = new GetCanceledResponse(mockPage, mockPayments); when(securityUtil.getCurrentMemberId()).thenReturn(1L); - when(memberGetService.getMemberById(1L)).thenReturn(mockMember); + when(memberQueryService.getMemberById(1L)).thenReturn(mockMember); when(reservationService.getCanceled(any(Member.class), eq(pageable))) .thenReturn(mockResponse); diff --git a/src/test/java/com/backoffice/upjuyanolja/domain/reservation/unit/controller/ReservationControllerTest.java b/src/test/java/com/backoffice/upjuyanolja/domain/reservation/unit/controller/ReservationControllerTest.java index d306a4b1..664868c0 100644 --- a/src/test/java/com/backoffice/upjuyanolja/domain/reservation/unit/controller/ReservationControllerTest.java +++ b/src/test/java/com/backoffice/upjuyanolja/domain/reservation/unit/controller/ReservationControllerTest.java @@ -10,7 +10,7 @@ import com.backoffice.upjuyanolja.domain.accommodation.entity.Category; import com.backoffice.upjuyanolja.domain.member.entity.Authority; import com.backoffice.upjuyanolja.domain.member.entity.Member; -import com.backoffice.upjuyanolja.domain.member.service.MemberGetService; +import com.backoffice.upjuyanolja.domain.member.service.MemberQueryService; import com.backoffice.upjuyanolja.domain.payment.entity.PayMethod; import com.backoffice.upjuyanolja.domain.payment.entity.Payment; import com.backoffice.upjuyanolja.domain.reservation.controller.ReservationController; @@ -73,7 +73,7 @@ class ReservationControllerTest { private SecurityUtil securityUtil; @MockBean - private MemberGetService memberGetService; + private MemberQueryService memberQueryService; @MockBean private ReservationService reservationService; @@ -300,7 +300,7 @@ void getReserved() throws Exception { GetReservedResponse mockResponse = new GetReservedResponse(mockPage, mockPayments); when(securityUtil.getCurrentMemberId()).thenReturn(1L); - when(memberGetService.getMemberById(1L)).thenReturn(mockMember); + when(memberQueryService.getMemberById(1L)).thenReturn(mockMember); when(reservationService.getReserved(any(Member.class), eq(pageable))) .thenReturn(mockResponse); @@ -383,7 +383,7 @@ void getCanceled() throws Exception { GetCanceledResponse mockResponse = new GetCanceledResponse(mockPage, mockPayments); when(securityUtil.getCurrentMemberId()).thenReturn(1L); - when(memberGetService.getMemberById(1L)).thenReturn(mockMember); + when(memberQueryService.getMemberById(1L)).thenReturn(mockMember); when(reservationService.getCanceled(any(Member.class), eq(pageable))) .thenReturn(mockResponse); diff --git a/src/test/java/com/backoffice/upjuyanolja/domain/room/unit/service/RoomCommandServiceTest.java b/src/test/java/com/backoffice/upjuyanolja/domain/room/unit/service/RoomCommandServiceTest.java index 88818684..cd67fc4c 100644 --- a/src/test/java/com/backoffice/upjuyanolja/domain/room/unit/service/RoomCommandServiceTest.java +++ b/src/test/java/com/backoffice/upjuyanolja/domain/room/unit/service/RoomCommandServiceTest.java @@ -15,7 +15,7 @@ import com.backoffice.upjuyanolja.domain.accommodation.service.AccommodationQueryService; import com.backoffice.upjuyanolja.domain.member.entity.Authority; import com.backoffice.upjuyanolja.domain.member.entity.Member; -import com.backoffice.upjuyanolja.domain.member.service.MemberGetService; +import com.backoffice.upjuyanolja.domain.member.service.MemberQueryService; import com.backoffice.upjuyanolja.domain.room.dto.request.RoomImageAddRequest; import com.backoffice.upjuyanolja.domain.room.dto.request.RoomImageDeleteRequest; import com.backoffice.upjuyanolja.domain.room.dto.request.RoomImageRequest; @@ -58,7 +58,7 @@ public class RoomCommandServiceTest { private RoomCommandService roomCommandService; @Mock - private MemberGetService memberGetService; + private MemberQueryService memberQueryService; @Mock private RoomQueryService roomQueryService; @@ -174,7 +174,7 @@ void _willSuccess() { .url("http://tong.visitkorea.or.kr/cms/resource/77/2876777_image2_1.jpg") .build(); - given(memberGetService.getMemberById(any(Long.TYPE))).willReturn(member); + given(memberQueryService.getMemberById(any(Long.TYPE))).willReturn(member); given(accommodationQueryService.getAccommodationById(any(Long.TYPE))) .willReturn(accommodation); doNothing().when(roomQueryService).checkOwnership( @@ -207,7 +207,7 @@ void _willSuccess() { assertThat(result.option().tv()).isEqualTo(true); assertThat(result.option().internet()).isEqualTo(true); - verify(memberGetService, times(1)).getMemberById(any(Long.TYPE)); + verify(memberQueryService, times(1)).getMemberById(any(Long.TYPE)); verify(accommodationQueryService, times(1)).getAccommodationById(any(Long.TYPE)); verify(roomQueryService, times(1)).checkOwnership( any(Member.class), @@ -485,7 +485,7 @@ void _willSuccess() { .url("http://tong.visitkorea.or.kr/cms/resource/77/2876777_image2_2.jpg") .build(); - given(memberGetService.getMemberById(any(Long.TYPE))).willReturn(member); + given(memberQueryService.getMemberById(any(Long.TYPE))).willReturn(member); given(roomQueryService.findRoomById(any(Long.TYPE))).willReturn(room); doNothing().when(roomQueryService).checkOwnership( any(Member.class), @@ -517,7 +517,7 @@ void _willSuccess() { assertThat(result.option().tv()).isEqualTo(true); assertThat(result.option().internet()).isEqualTo(true); - verify(memberGetService, times(1)).getMemberById(any(Long.TYPE)); + verify(memberQueryService, times(1)).getMemberById(any(Long.TYPE)); verify(roomQueryService, times(1)).findRoomById(any(Long.TYPE)); verify(roomQueryService, times(1)).checkOwnership( any(Member.class), @@ -600,7 +600,7 @@ void _willSuccess() { .peakWeekendMinFee(100000) .build(); - given(memberGetService.getMemberById(any(Long.TYPE))).willReturn(member); + given(memberQueryService.getMemberById(any(Long.TYPE))).willReturn(member); given(roomQueryService.findRoomById(any(Long.TYPE))).willReturn(room); doNothing().when(roomQueryService).checkOwnership( any(Member.class), @@ -632,7 +632,7 @@ void _willSuccess() { assertThat(result.option().tv()).isEqualTo(true); assertThat(result.option().internet()).isEqualTo(true); - verify(memberGetService, times(1)).getMemberById(any(Long.TYPE)); + verify(memberQueryService, times(1)).getMemberById(any(Long.TYPE)); verify(roomQueryService, times(1)).findRoomById(any(Long.TYPE)); verify(roomQueryService, times(1)).checkOwnership( any(Member.class), diff --git a/src/test/java/com/backoffice/upjuyanolja/domain/room/unit/service/RoomQueryServiceTest.java b/src/test/java/com/backoffice/upjuyanolja/domain/room/unit/service/RoomQueryServiceTest.java index b836acde..3c0d19e7 100644 --- a/src/test/java/com/backoffice/upjuyanolja/domain/room/unit/service/RoomQueryServiceTest.java +++ b/src/test/java/com/backoffice/upjuyanolja/domain/room/unit/service/RoomQueryServiceTest.java @@ -19,7 +19,7 @@ import com.backoffice.upjuyanolja.domain.coupon.service.CouponService; import com.backoffice.upjuyanolja.domain.member.entity.Authority; import com.backoffice.upjuyanolja.domain.member.entity.Member; -import com.backoffice.upjuyanolja.domain.member.service.MemberGetService; +import com.backoffice.upjuyanolja.domain.member.service.MemberQueryService; import com.backoffice.upjuyanolja.domain.room.dto.request.RoomPageRequest; import com.backoffice.upjuyanolja.domain.room.dto.response.RoomInfoResponse; import com.backoffice.upjuyanolja.domain.room.dto.response.RoomPageResponse; @@ -56,7 +56,7 @@ public class RoomQueryServiceTest { private RoomQueryService roomQueryService; @Mock - private MemberGetService memberGetService; + private MemberQueryService memberQueryService; @Mock private AccommodationRepository accommodationRepository; @@ -217,7 +217,7 @@ void _willSuccess() { .build() ); - given(memberGetService.getMemberById(any(Long.TYPE))).willReturn(member); + given(memberQueryService.getMemberById(any(Long.TYPE))).willReturn(member); given(accommodationRepository.findById(any(Long.TYPE))) .willReturn(Optional.of(accommodation)); given(accommodationOwnershipRepository @@ -267,7 +267,7 @@ void _willSuccess() { assertThat(result.rooms().get(0).option().internet()).isEqualTo(true); assertThat(result.rooms().get(0).coupons()).isNotEmpty(); - verify(memberGetService, times(1)).getMemberById(any(Long.TYPE)); + verify(memberQueryService, times(1)).getMemberById(any(Long.TYPE)); verify(accommodationRepository, times(1)).findById(any(Long.TYPE)); verify(accommodationOwnershipRepository, times(1)) .existsAccommodationOwnershipByMemberAndAccommodation( @@ -361,7 +361,7 @@ void _willSuccess() { .peakWeekendMinFee(100000) .build(); - given(memberGetService.getMemberById(any(Long.TYPE))).willReturn(member); + given(memberQueryService.getMemberById(any(Long.TYPE))).willReturn(member); given(roomRepository.findById(any(Long.TYPE))).willReturn(Optional.of(room)); given(accommodationOwnershipRepository .existsAccommodationOwnershipByMemberAndAccommodation( @@ -395,7 +395,7 @@ void _willSuccess() { assertThat(result.option().tv()).isEqualTo(true); assertThat(result.option().internet()).isEqualTo(true); - verify(memberGetService, times(1)).getMemberById(any(Long.TYPE)); + verify(memberQueryService, times(1)).getMemberById(any(Long.TYPE)); verify(roomRepository, times(1)).findById(any(Long.TYPE)); verify(accommodationOwnershipRepository, times(1)) .existsAccommodationOwnershipByMemberAndAccommodation(