diff --git a/Server/src/main/java/JGS/CasperEvent/domain/event/service/adminService/AdminService.java b/Server/src/main/java/JGS/CasperEvent/domain/event/service/adminService/AdminService.java index 3fe772e5..bb6451d6 100644 --- a/Server/src/main/java/JGS/CasperEvent/domain/event/service/adminService/AdminService.java +++ b/Server/src/main/java/JGS/CasperEvent/domain/event/service/adminService/AdminService.java @@ -23,6 +23,7 @@ import JGS.CasperEvent.domain.event.repository.participantsRepository.LotteryParticipantsRepository; import JGS.CasperEvent.domain.event.repository.participantsRepository.LotteryWinnerRepository; import JGS.CasperEvent.domain.event.repository.participantsRepository.RushParticipantsRepository; +import JGS.CasperEvent.domain.event.service.eventService.EventCacheService; import JGS.CasperEvent.global.enums.CustomErrorCode; import JGS.CasperEvent.global.enums.Position; import JGS.CasperEvent.global.enums.Role; @@ -58,6 +59,7 @@ public class AdminService { private final CasperBotRepository casperBotRepository; private final LotteryWinnerRepository lotteryWinnerRepository; private final RedisTemplate casperBotRedisTemplate; + private final EventCacheService eventCacheService; private final Random random = new Random(); // 어드민 인증 @@ -75,7 +77,7 @@ public ResponseDto postAdmin(AdminRequestDto adminRequestDto) { if (admin != null) throw new CustomException("이미 등록된 ID입니다.", CustomErrorCode.CONFLICT); adminRepository.save(new Admin(adminId, password, Role.ADMIN)); - return ResponseDto.of("관리자 생성 성공"); + return new ResponseDto("관리자 생성 성공"); } // 이미지 업로드 @@ -93,6 +95,7 @@ public LotteryEventResponseDto createLotteryEvent(LotteryEventRequestDto lottery lotteryEventRequestDto.getWinnerCount() )); + eventCacheService.setLotteryEvent(); return LotteryEventResponseDto.of(lotteryEvent, LocalDateTime.now()); } @@ -280,7 +283,7 @@ public void deleteLotteryEvent() { lotteryEventRepository.deleteById(currentLotteryEvent.getLotteryEventId()); } - // 선착순 이벤트 업데이트 + // 추첨 이벤트 업데이트 @Transactional public LotteryEventDetailResponseDto updateLotteryEvent(LotteryEventRequestDto lotteryEventRequestDto) { LotteryEvent currentLotteryEvent = getCurrentLotteryEvent(); @@ -311,7 +314,7 @@ else if (newStartDateTime.isBefore(now)) { // 필드 업데이트 currentLotteryEvent.updateLotteryEvent(newStartDateTime, newEndDateTime, lotteryEventRequestDto.getWinnerCount()); - + eventCacheService.setLotteryEvent(); return LotteryEventDetailResponseDto.of(currentLotteryEvent); } @@ -508,7 +511,7 @@ public ResponseDto deleteRushEvent(Long rushEventId) { if (now.isAfter(startDateTime) && now.isBefore(endDateTime)) throw new CustomException(CustomErrorCode.EVENT_IN_PROGRESS_CANNOT_DELETE); rushEventRepository.delete(rushEvent); - return ResponseDto.of("요청에 성공하였습니다."); + return new ResponseDto("요청에 성공하였습니다."); } // 선착순 이벤트 선택지 조회 diff --git a/Server/src/main/java/JGS/CasperEvent/domain/event/service/eventService/RushEventCacheService.java b/Server/src/main/java/JGS/CasperEvent/domain/event/service/eventService/EventCacheService.java similarity index 61% rename from Server/src/main/java/JGS/CasperEvent/domain/event/service/eventService/RushEventCacheService.java rename to Server/src/main/java/JGS/CasperEvent/domain/event/service/eventService/EventCacheService.java index b37b4b9b..5fc7ddbd 100644 --- a/Server/src/main/java/JGS/CasperEvent/domain/event/service/eventService/RushEventCacheService.java +++ b/Server/src/main/java/JGS/CasperEvent/domain/event/service/eventService/EventCacheService.java @@ -1,7 +1,9 @@ package JGS.CasperEvent.domain.event.service.eventService; import JGS.CasperEvent.domain.event.dto.ResponseDto.rushEventResponseDto.RushEventResponseDto; +import JGS.CasperEvent.domain.event.entity.event.LotteryEvent; import JGS.CasperEvent.domain.event.entity.event.RushEvent; +import JGS.CasperEvent.domain.event.repository.eventRepository.LotteryEventRepository; import JGS.CasperEvent.domain.event.repository.eventRepository.RushEventRepository; import JGS.CasperEvent.global.enums.CustomErrorCode; import JGS.CasperEvent.global.error.exception.CustomException; @@ -17,9 +19,36 @@ @Service @RequiredArgsConstructor @Slf4j -public class RushEventCacheService { +public class EventCacheService { private final RushEventRepository rushEventRepository; + private final LotteryEventRepository lotteryEventRepository; + + @Cacheable(value = "ongoingLotteryEvent") + public LotteryEvent getLotteryEvent(){ + return fetchOngoingLotteryEvent(); + } + + @CachePut(value = "ongoingLotteryEvent") + public LotteryEvent setLotteryEvent() { + // 오늘 날짜에 해당하는 모든 이벤트 꺼내옴 + return fetchOngoingLotteryEvent(); + } + + private LotteryEvent fetchOngoingLotteryEvent() { + // 오늘 날짜에 해당하는 모든 이벤트 꺼내옴 + List lotteryEventList = lotteryEventRepository.findAll(); + + if (lotteryEventList.isEmpty()) { + throw new CustomException("현재 진행중인 lotteryEvent가 존재하지 않습니다.", CustomErrorCode.NO_LOTTERY_EVENT); + } + + if (lotteryEventList.size() > 1) { + throw new CustomException("현재 진행중인 lotteryEvent가 2개 이상입니다.", CustomErrorCode.TOO_MANY_LOTTERY_EVENT); + } + + return lotteryEventList.get(0); + } @Cacheable(value = "todayEventCache", key = "#today") public RushEventResponseDto getTodayEvent(LocalDate today) { diff --git a/Server/src/main/java/JGS/CasperEvent/domain/event/service/eventService/LotteryEventService.java b/Server/src/main/java/JGS/CasperEvent/domain/event/service/eventService/LotteryEventService.java index 76712bc1..bed67f2f 100644 --- a/Server/src/main/java/JGS/CasperEvent/domain/event/service/eventService/LotteryEventService.java +++ b/Server/src/main/java/JGS/CasperEvent/domain/event/service/eventService/LotteryEventService.java @@ -1,9 +1,7 @@ package JGS.CasperEvent.domain.event.service.eventService; import JGS.CasperEvent.domain.event.dto.RequestDto.lotteryEventDto.CasperBotRequestDto; -import JGS.CasperEvent.domain.event.dto.ResponseDto.lotteryEventResponseDto.CasperBotResponseDto; -import JGS.CasperEvent.domain.event.dto.ResponseDto.lotteryEventResponseDto.LotteryEventResponseDto; -import JGS.CasperEvent.domain.event.dto.ResponseDto.lotteryEventResponseDto.LotteryParticipantResponseDto; +import JGS.CasperEvent.domain.event.dto.ResponseDto.lotteryEventResponseDto.*; import JGS.CasperEvent.domain.event.entity.casperBot.CasperBot; import JGS.CasperEvent.domain.event.entity.event.LotteryEvent; import JGS.CasperEvent.domain.event.entity.participants.LotteryParticipants; @@ -29,7 +27,6 @@ import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; import java.time.LocalDateTime; -import java.util.List; import java.util.Optional; @Service @@ -39,16 +36,16 @@ public class LotteryEventService { private static final Logger log = LoggerFactory.getLogger(LotteryEventService.class); private final UserRepository userRepository; - private final LotteryEventRepository lotteryEventRepository; private final LotteryParticipantsRepository lotteryParticipantsRepository; private final CasperBotRepository casperBotRepository; private final RedisService redisService; private final SecretKey secretKey; + private final EventCacheService eventCacheService; public CasperBotResponseDto postCasperBot(BaseUser user, CasperBotRequestDto casperBotRequestDto) throws CustomException, NoSuchPaddingException, IllegalBlockSizeException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException { LotteryParticipants participants = registerUserIfNeed(user, casperBotRequestDto); - LotteryEvent lotteryEvent = getEvent(); + LotteryEvent lotteryEvent = eventCacheService.getLotteryEvent(); CasperBot casperBot = casperBotRepository.save(new CasperBot(casperBotRequestDto, user.getId())); lotteryEvent.addAppliedCount(); @@ -112,21 +109,7 @@ private void addReferralAppliedCount(CasperBotRequestDto casperBotRequestDto) th } public LotteryEventResponseDto getLotteryEvent() { - LotteryEvent lotteryEvent = getEvent(); + LotteryEvent lotteryEvent = eventCacheService.getLotteryEvent(); return LotteryEventResponseDto.of(lotteryEvent, LocalDateTime.now()); } - - private LotteryEvent getEvent() { - List lotteryEventList = lotteryEventRepository.findAll(); - - if (lotteryEventList.isEmpty()) { - throw new CustomException("현재 진행중인 lotteryEvent가 존재하지 않습니다.", CustomErrorCode.NO_LOTTERY_EVENT); - } - - if (lotteryEventList.size() > 1) { - throw new CustomException("현재 진행중인 lotteryEvent가 2개 이상입니다.", CustomErrorCode.TOO_MANY_LOTTERY_EVENT); - } - - return lotteryEventList.get(0); - } } diff --git a/Server/src/main/java/JGS/CasperEvent/domain/event/service/eventService/RushEventService.java b/Server/src/main/java/JGS/CasperEvent/domain/event/service/eventService/RushEventService.java index ca2e2c16..2906c3df 100644 --- a/Server/src/main/java/JGS/CasperEvent/domain/event/service/eventService/RushEventService.java +++ b/Server/src/main/java/JGS/CasperEvent/domain/event/service/eventService/RushEventService.java @@ -29,14 +29,14 @@ public class RushEventService { private final RushEventRepository rushEventRepository; private final RushParticipantsRepository rushParticipantsRepository; private final RushOptionRepository rushOptionRepository; - private final RushEventCacheService rushEventCacheService; + private final EventCacheService eventCacheService; @Transactional public RushEventListResponseDto getAllRushEvents() { LocalDate today = LocalDate.now(); // 오늘의 선착순 이벤트 꺼내오기 - RushEventResponseDto todayEvent = rushEventCacheService.getTodayEvent(today); + RushEventResponseDto todayEvent = eventCacheService.getTodayEvent(today); // DB에서 모든 RushEvent 가져오기 List rushEventList = rushEventRepository.findAll(); @@ -69,14 +69,14 @@ public RushEventListResponseDto getAllRushEvents() { // 응모 여부 조회 public boolean isExists(String userId) { LocalDate today = LocalDate.now(); - Long todayEventId = rushEventCacheService.getTodayEvent(today).rushEventId(); + Long todayEventId = eventCacheService.getTodayEvent(today).rushEventId(); return rushParticipantsRepository.existsByRushEvent_RushEventIdAndBaseUser_Id(todayEventId, userId); } @Transactional public void apply(BaseUser user, int optionId) { LocalDate today = LocalDate.now(); - Long todayEventId = rushEventCacheService.getTodayEvent(today).rushEventId(); + Long todayEventId = eventCacheService.getTodayEvent(today).rushEventId(); // 이미 응모한 회원인지 검증 if (rushParticipantsRepository.existsByRushEvent_RushEventIdAndBaseUser_Id(todayEventId, user.getId())) { @@ -94,7 +94,7 @@ public void apply(BaseUser user, int optionId) { // 진행중인 게임의 응모 비율 반환 public RushEventRateResponseDto getRushEventRate(BaseUser user) { LocalDate today = LocalDate.now(); - Long todayEventId = rushEventCacheService.getTodayEvent(today).rushEventId(); + Long todayEventId = eventCacheService.getTodayEvent(today).rushEventId(); Optional optionId = rushParticipantsRepository.getOptionIdByUserId(user.getId()); long leftOptionCount = rushParticipantsRepository.countByRushEvent_RushEventIdAndOptionId(todayEventId, 1); long rightOptionCount = rushParticipantsRepository.countByRushEvent_RushEventIdAndOptionId(todayEventId, 2); @@ -109,7 +109,7 @@ public RushEventRateResponseDto getRushEventRate(BaseUser user) { @Transactional public RushEventResultResponseDto getRushEventResult(BaseUser user) { LocalDate today = LocalDate.now(); - RushEventResponseDto todayRushEvent = rushEventCacheService.getTodayEvent(today); + RushEventResponseDto todayRushEvent = eventCacheService.getTodayEvent(today); Long todayEventId = todayRushEvent.rushEventId(); // 최종 선택 비율을 조회 @@ -228,14 +228,14 @@ public void setRushEvents() { rushEvents.add(rushEvent); } - rushEventCacheService.setCacheValue(LocalDate.now()); + eventCacheService.setCacheValue(LocalDate.now()); } // 오늘의 이벤트 옵션 정보를 반환 public MainRushEventOptionsResponseDto getTodayRushEventOptions() { LocalDate today = LocalDate.now(); - RushEventResponseDto todayEvent = rushEventCacheService.getTodayEvent(today); + RushEventResponseDto todayEvent = eventCacheService.getTodayEvent(today); Set options = todayEvent.options(); RushEventOptionResponseDto leftOption = options.stream() @@ -257,7 +257,7 @@ public MainRushEventOptionsResponseDto getTodayRushEventOptions() { public ResultRushEventOptionResponseDto getRushEventOptionResult(int optionId) { Position position = Position.of(optionId); LocalDate today = LocalDate.now(); - RushEventResponseDto todayEvent = rushEventCacheService.getTodayEvent(today); + RushEventResponseDto todayEvent = eventCacheService.getTodayEvent(today); Set options = todayEvent.options(); if (options.size() != 2) { diff --git a/Server/src/main/java/JGS/CasperEvent/global/config/CacheConfig.java b/Server/src/main/java/JGS/CasperEvent/global/config/CacheConfig.java index 34abdd90..35d362bd 100644 --- a/Server/src/main/java/JGS/CasperEvent/global/config/CacheConfig.java +++ b/Server/src/main/java/JGS/CasperEvent/global/config/CacheConfig.java @@ -10,7 +10,7 @@ public class CacheConfig { @Bean public CacheManager cacheManager() { - return new ConcurrentMapCacheManager("todayEventCache"); + return new ConcurrentMapCacheManager("todayEventCache", "ongoingLotteryEvent"); } } diff --git a/Server/src/main/java/JGS/CasperEvent/global/response/ResponseDto.java b/Server/src/main/java/JGS/CasperEvent/global/response/ResponseDto.java index 97f4408b..4ef85a74 100644 --- a/Server/src/main/java/JGS/CasperEvent/global/response/ResponseDto.java +++ b/Server/src/main/java/JGS/CasperEvent/global/response/ResponseDto.java @@ -1,8 +1,5 @@ package JGS.CasperEvent.global.response; public record ResponseDto(String message) { - public static ResponseDto of(String message) { - return new ResponseDto(message); - } } diff --git a/Server/src/test/java/JGS/CasperEvent/domain/event/controller/adminController/AdminControllerTest.java b/Server/src/test/java/JGS/CasperEvent/domain/event/controller/adminController/AdminControllerTest.java index d867cbbc..b937ecf9 100644 --- a/Server/src/test/java/JGS/CasperEvent/domain/event/controller/adminController/AdminControllerTest.java +++ b/Server/src/test/java/JGS/CasperEvent/domain/event/controller/adminController/AdminControllerTest.java @@ -291,7 +291,7 @@ void postAdminSuccessTest() throws Exception { AdminRequestDto adminRequestDto = AdminRequestDto.builder().adminId(adminId).password(password).build(); String requestBody = objectMapper.writeValueAsString(adminRequestDto); - given(adminService.postAdmin(adminRequestDto)).willReturn(ResponseDto.of("관리자 생성 성공")); + given(adminService.postAdmin(adminRequestDto)).willReturn(new ResponseDto("관리자 생성 성공")); //when ResultActions perform = mockMvc.perform(post("/admin/join").contentType(APPLICATION_JSON).content(requestBody)); @@ -666,7 +666,7 @@ void deleteLotteryEventExpectationSuccessTest() throws Exception { void pickLotteryEventWinnerSuccessTest() throws Exception { //given given(adminService.pickLotteryEventWinners()) - .willReturn(ResponseDto.of("추첨이 완료되었습니다.")); + .willReturn(new ResponseDto("추첨이 완료되었습니다.")); //when ResultActions perform = mockMvc.perform(post("/admin/event/lottery/winner") @@ -684,7 +684,7 @@ void pickLotteryEventWinnerSuccessTest() throws Exception { void deleteLotteryEventWinners() throws Exception { //given given(adminService.deleteLotteryEventWinners()) - .willReturn(ResponseDto.of("당첨자 명단을 삭제했습니다.")); + .willReturn(new ResponseDto("당첨자 명단을 삭제했습니다.")); //when ResultActions perform = mockMvc.perform(delete("/admin/event/lottery/winner") diff --git a/Server/src/test/java/JGS/CasperEvent/domain/event/service/eventService/RushEventServiceTest.java b/Server/src/test/java/JGS/CasperEvent/domain/event/service/eventService/RushEventServiceTest.java index b4424800..8725490b 100644 --- a/Server/src/test/java/JGS/CasperEvent/domain/event/service/eventService/RushEventServiceTest.java +++ b/Server/src/test/java/JGS/CasperEvent/domain/event/service/eventService/RushEventServiceTest.java @@ -40,7 +40,7 @@ class RushEventServiceTest { private RushOptionRepository rushOptionRepository; @Mock - private RushEventCacheService rushEventCacheService; + private EventCacheService eventCacheService; @InjectMocks RushEventService rushEventService; @@ -63,7 +63,7 @@ void getAllRushEvents() { new RushEvent() ); - given(rushEventCacheService.getTodayEvent(LocalDate.now())).willReturn(todayEvent); + given(eventCacheService.getTodayEvent(LocalDate.now())).willReturn(todayEvent); given(rushEventRepository.findAll()).willReturn(rushEventList); // when @@ -90,7 +90,7 @@ void isExists() { new HashSet<>() ); - given(rushEventCacheService.getTodayEvent(LocalDate.now())).willReturn(todayEvent); + given(eventCacheService.getTodayEvent(LocalDate.now())).willReturn(todayEvent); given(rushParticipantsRepository.existsByRushEvent_RushEventIdAndBaseUser_Id(1L, user.getId())).willReturn(true); // when @@ -115,7 +115,7 @@ void apply() { new HashSet<>() ); - given(rushEventCacheService.getTodayEvent(LocalDate.now())).willReturn(todayEvent); + given(eventCacheService.getTodayEvent(LocalDate.now())).willReturn(todayEvent); given(rushParticipantsRepository.existsByRushEvent_RushEventIdAndBaseUser_Id(1L, user.getId())).willReturn(false); RushEvent rushEvent = new RushEvent(); given(rushEventRepository.findById(1L)).willReturn(Optional.of(rushEvent)); @@ -142,7 +142,7 @@ void apply2() { new HashSet<>() ); - given(rushEventCacheService.getTodayEvent(LocalDate.now())).willReturn(todayEvent); + given(eventCacheService.getTodayEvent(LocalDate.now())).willReturn(todayEvent); given(rushParticipantsRepository.existsByRushEvent_RushEventIdAndBaseUser_Id(1L, user.getId())).willReturn(true); // when & then @@ -170,7 +170,7 @@ void getRushEventRate() { new HashSet<>() ); - given(rushEventCacheService.getTodayEvent(LocalDate.now())).willReturn(todayEvent); + given(eventCacheService.getTodayEvent(LocalDate.now())).willReturn(todayEvent); given(rushParticipantsRepository.getOptionIdByUserId(user.getId())).willReturn(Optional.of(1)); given(rushParticipantsRepository.countByRushEvent_RushEventIdAndOptionId(1L, 1)).willReturn(100L); given(rushParticipantsRepository.countByRushEvent_RushEventIdAndOptionId(1L, 2)).willReturn(200L); @@ -200,7 +200,7 @@ void getRushEventResult() { new HashSet<>() ); - given(rushEventCacheService.getTodayEvent(LocalDate.now())).willReturn(todayEvent); + given(eventCacheService.getTodayEvent(LocalDate.now())).willReturn(todayEvent); given(rushParticipantsRepository.getOptionIdByUserId(user.getId())).willReturn(Optional.of(1)); given(rushParticipantsRepository.countByRushEvent_RushEventIdAndOptionId(1L, 1)).willReturn(700L); given(rushParticipantsRepository.countByRushEvent_RushEventIdAndOptionId(1L, 2)).willReturn(500L); @@ -234,7 +234,7 @@ void getRushEventResult2() { new HashSet<>() ); - given(rushEventCacheService.getTodayEvent(LocalDate.now())).willReturn(todayEvent); + given(eventCacheService.getTodayEvent(LocalDate.now())).willReturn(todayEvent); given(rushParticipantsRepository.getOptionIdByUserId(user.getId())).willReturn(Optional.of(2)); given(rushParticipantsRepository.countByRushEvent_RushEventIdAndOptionId(1L, 1)).willReturn(700L); given(rushParticipantsRepository.countByRushEvent_RushEventIdAndOptionId(1L, 2)).willReturn(500L); @@ -268,7 +268,7 @@ void getRushEventResult3() { new HashSet<>() ); - given(rushEventCacheService.getTodayEvent(LocalDate.now())).willReturn(todayEvent); + given(eventCacheService.getTodayEvent(LocalDate.now())).willReturn(todayEvent); given(rushParticipantsRepository.getOptionIdByUserId(user.getId())).willReturn(Optional.of(1)); given(rushParticipantsRepository.countByRushEvent_RushEventIdAndOptionId(1L, 1)).willReturn(700L); given(rushParticipantsRepository.countByRushEvent_RushEventIdAndOptionId(1L, 2)).willReturn(500L); @@ -302,7 +302,7 @@ void getRushEventResult4() { new HashSet<>() ); - given(rushEventCacheService.getTodayEvent(LocalDate.now())).willReturn(todayEvent); + given(eventCacheService.getTodayEvent(LocalDate.now())).willReturn(todayEvent); given(rushParticipantsRepository.getOptionIdByUserId(user.getId())).willReturn(Optional.of(1)); given(rushParticipantsRepository.countByRushEvent_RushEventIdAndOptionId(1L, 1)).willReturn(500L); given(rushParticipantsRepository.countByRushEvent_RushEventIdAndOptionId(1L, 2)).willReturn(500L); @@ -335,7 +335,7 @@ void getRushEventResult5() { new HashSet<>() ); - given(rushEventCacheService.getTodayEvent(LocalDate.now())).willReturn(todayEvent); + given(eventCacheService.getTodayEvent(LocalDate.now())).willReturn(todayEvent); given(rushParticipantsRepository.getOptionIdByUserId(user.getId())).willReturn(Optional.of(1)); given(rushParticipantsRepository.countByRushEvent_RushEventIdAndOptionId(1L, 1)).willReturn(500L); given(rushParticipantsRepository.countByRushEvent_RushEventIdAndOptionId(1L, 2)).willReturn(500L); @@ -368,7 +368,7 @@ void getRushEventResult6() { new HashSet<>() ); - given(rushEventCacheService.getTodayEvent(LocalDate.now())).willReturn(todayEvent); + given(eventCacheService.getTodayEvent(LocalDate.now())).willReturn(todayEvent); given(rushParticipantsRepository.getOptionIdByUserId(user.getId())).willReturn(Optional.empty()); given(rushParticipantsRepository.countByRushEvent_RushEventIdAndOptionId(1L, 1)).willReturn(500L); given(rushParticipantsRepository.countByRushEvent_RushEventIdAndOptionId(1L, 2)).willReturn(500L); @@ -421,7 +421,7 @@ void getTodayRushEventOptions() { ) ); - given(rushEventCacheService.getTodayEvent(LocalDate.now())).willReturn(todayEvent); + given(eventCacheService.getTodayEvent(LocalDate.now())).willReturn(todayEvent); // when MainRushEventOptionsResponseDto result = rushEventService.getTodayRushEventOptions(); @@ -450,7 +450,7 @@ void getRushEventOptionResult() { ) ); - given(rushEventCacheService.getTodayEvent(LocalDate.now())).willReturn(todayEvent); + given(eventCacheService.getTodayEvent(LocalDate.now())).willReturn(todayEvent); // when ResultRushEventOptionResponseDto result = rushEventService.getRushEventOptionResult(optionId); @@ -478,7 +478,7 @@ void getRushEventOptionResult2() { ) ); - given(rushEventCacheService.getTodayEvent(LocalDate.now())).willReturn(todayEvent); + given(eventCacheService.getTodayEvent(LocalDate.now())).willReturn(todayEvent); // when & then CustomException exception = assertThrows(CustomException.class, () -> rushEventService.getRushEventOptionResult(optionId) @@ -521,7 +521,7 @@ void getRushEventOptionResult4() { ) ); - given(rushEventCacheService.getTodayEvent(LocalDate.now())).willReturn(todayEvent); + given(eventCacheService.getTodayEvent(LocalDate.now())).willReturn(todayEvent); // when & then CustomException exception = assertThrows(CustomException.class, () -> rushEventService.getRushEventOptionResult(optionId)