From 3ee6696f9d3606e1a219470db0be867a1c3dd5b3 Mon Sep 17 00:00:00 2001 From: Seonghun Jeong Date: Thu, 7 Nov 2024 10:06:23 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20CallbackRepository=20=EC=9E=98=EB=AA=BB?= =?UTF-8?q?=EB=90=9C=20=EB=A9=94=EC=84=9C=EB=93=9C=20=EC=A0=9C=EA=B1=B0=20?= =?UTF-8?q?=ED=9B=84=20=EC=9D=98=EC=A1=B4=ED=95=98=EB=8A=94=20=EC=BD=94?= =?UTF-8?q?=EB=93=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sinitto/callback/repository/CallbackRepository.java | 3 --- .../com/example/sinitto/callback/service/CallbackService.java | 2 +- .../example/sinitto/callback/service/CallbackServiceTest.java | 4 ++-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/example/sinitto/callback/repository/CallbackRepository.java b/src/main/java/com/example/sinitto/callback/repository/CallbackRepository.java index 3d38e2f2..4b77010f 100644 --- a/src/main/java/com/example/sinitto/callback/repository/CallbackRepository.java +++ b/src/main/java/com/example/sinitto/callback/repository/CallbackRepository.java @@ -1,7 +1,6 @@ package com.example.sinitto.callback.repository; import com.example.sinitto.callback.entity.Callback; -import com.example.sinitto.member.entity.Member; import com.example.sinitto.member.entity.Senior; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; @@ -17,8 +16,6 @@ public interface CallbackRepository extends JpaRepository { Optional findByAssignedMemberIdAndStatus(Long memberId, Callback.Status status); - Optional findByAssignedMemberAndStatus(Member member, Callback.Status status); - boolean existsByAssignedMemberIdAndStatus(Long memberId, Callback.Status status); Page findAllBySeniorIn(List seniors, Pageable pageable); diff --git a/src/main/java/com/example/sinitto/callback/service/CallbackService.java b/src/main/java/com/example/sinitto/callback/service/CallbackService.java index 0ea52b3e..d4b7efb4 100644 --- a/src/main/java/com/example/sinitto/callback/service/CallbackService.java +++ b/src/main/java/com/example/sinitto/callback/service/CallbackService.java @@ -222,7 +222,7 @@ public CallbackForSinittoResponse getCallbackForSinitto(Long memberId, Long call @Transactional public void cancelAssignedCallbackIfInProgress(Member member) { - Callback callback = callbackRepository.findByAssignedMemberAndStatus(member, Callback.Status.IN_PROGRESS) + Callback callback = callbackRepository.findByAssignedMemberIdAndStatus(member.getId(), Callback.Status.IN_PROGRESS) .orElse(null); if (callback != null) { diff --git a/src/test/java/com/example/sinitto/callback/service/CallbackServiceTest.java b/src/test/java/com/example/sinitto/callback/service/CallbackServiceTest.java index 3919a9e9..eeee9b71 100644 --- a/src/test/java/com/example/sinitto/callback/service/CallbackServiceTest.java +++ b/src/test/java/com/example/sinitto/callback/service/CallbackServiceTest.java @@ -541,7 +541,7 @@ void cancelAssignedCallbackIfInProgress1() { Member member = mock(Member.class); Callback callback = mock(Callback.class); - when(callbackRepository.findByAssignedMemberAndStatus(any(Member.class), any(Callback.Status.class))).thenReturn(Optional.of(callback)); + when(callbackRepository.findByAssignedMemberIdAndStatus(anyLong(), any(Callback.Status.class))).thenReturn(Optional.of(callback)); //when callbackService.cancelAssignedCallbackIfInProgress(member); @@ -558,7 +558,7 @@ void cancelAssignedCallbackIfInProgress2() { Member member = mock(Member.class); Callback callback = mock(Callback.class); - when(callbackRepository.findByAssignedMemberAndStatus(any(Member.class), any(Callback.Status.class))).thenReturn(Optional.empty()); + when(callbackRepository.findByAssignedMemberIdAndStatus(anyLong(), any(Callback.Status.class))).thenReturn(Optional.empty()); //when callbackService.cancelAssignedCallbackIfInProgress(member);