diff --git a/src/main/java/com/moabam/api/domain/coupon/repository/CouponManageRepository.java b/src/main/java/com/moabam/api/domain/coupon/repository/CouponManageRepository.java index 8d916802..400c7232 100644 --- a/src/main/java/com/moabam/api/domain/coupon/repository/CouponManageRepository.java +++ b/src/main/java/com/moabam/api/domain/coupon/repository/CouponManageRepository.java @@ -39,10 +39,6 @@ public Set range(String couponName, long start, long end) { .collect(Collectors.toSet()); } - public Long queueSize(String couponName) { - return zSetRedisRepository.size(requireNonNull(couponName)); - } - public void deleteQueue(String couponName) { valueRedisRepository.delete(requireNonNull(couponName)); } diff --git a/src/main/java/com/moabam/api/infrastructure/redis/ZSetRedisRepository.java b/src/main/java/com/moabam/api/infrastructure/redis/ZSetRedisRepository.java index d38a1cf3..d16b6456 100644 --- a/src/main/java/com/moabam/api/infrastructure/redis/ZSetRedisRepository.java +++ b/src/main/java/com/moabam/api/infrastructure/redis/ZSetRedisRepository.java @@ -30,8 +30,4 @@ public Set range(String key, long start, long end) { .opsForZSet() .range(key, start, end); } - - public Long size(String key) { - return redisTemplate.opsForZSet().size(key); - } } diff --git a/src/test/java/com/moabam/api/application/coupon/CouponManageServiceTest.java b/src/test/java/com/moabam/api/application/coupon/CouponManageServiceTest.java index ea69c9da..d7e25d43 100644 --- a/src/test/java/com/moabam/api/application/coupon/CouponManageServiceTest.java +++ b/src/test/java/com/moabam/api/application/coupon/CouponManageServiceTest.java @@ -60,7 +60,7 @@ void init_success() { assertThatNoException().isThrownBy(() -> couponManageService.init()); } - @DisplayName("10명ㅗ두 쿠폰 발행이 성공적으로 된다.") + @DisplayName("10명의 사용자가 쿠폰 발행을 성공적으로 한.") @MethodSource("com.moabam.support.fixture.CouponFixture#provideValues_Long") @ParameterizedTest void issue_all_success(Set values) { @@ -76,7 +76,6 @@ void issue_all_success(Set values) { couponManageService.issue(); // Then - verify(couponManageRepository).queueSize(any(String.class)); verify(couponWalletRepository, times(10)).save(any(CouponWallet.class)); verify(notificationService, times(10)) .sendCouponIssueResult(any(Long.class), any(String.class), any(String.class)); @@ -95,7 +94,6 @@ void issue_notStartAt() { // Then verify(couponManageRepository, times(0)).increaseIssuedStock(any(String.class)); verify(couponWalletRepository, times(0)).save(any(CouponWallet.class)); - verify(couponManageRepository, times(0)).queueSize(any(String.class)); verify(couponManageRepository, times(0)) .range(any(String.class), any(long.class), any(long.class)); verify(notificationService, times(0)) @@ -118,7 +116,6 @@ void issue_stockEnd(Set values) { couponManageService.issue(); // Then - verify(couponManageRepository).queueSize(any(String.class)); verify(couponManageRepository, times(10)).increaseIssuedStock(any(String.class)); verify(couponWalletRepository, times(0)).save(any(CouponWallet.class)); verify(notificationService, times(10)) diff --git a/src/test/java/com/moabam/api/domain/coupon/repository/CouponManageRepositoryTest.java b/src/test/java/com/moabam/api/domain/coupon/repository/CouponManageRepositoryTest.java index 60bc1000..6d1b9798 100644 --- a/src/test/java/com/moabam/api/domain/coupon/repository/CouponManageRepositoryTest.java +++ b/src/test/java/com/moabam/api/domain/coupon/repository/CouponManageRepositoryTest.java @@ -78,27 +78,6 @@ void range_NullPointerException() { .isInstanceOf(NullPointerException.class); } - @DisplayName("대기열의 사이즈를 성공적으로 반환한다. - Long") - @Test - void queueSize_success() { - // Given - given(zSetRedisRepository.size(any(String.class))).willReturn(2L); - - // When - Long actual = couponManageRepository.queueSize("CouponName"); - - // Then - assertThat(actual).isEqualTo(2L); - } - - @DisplayName("쿠폰명이 Null인 대기열의 사이즈를 반환한다. - NullPointerException") - @Test - void queueSize_NullPointerException() { - // When & Then - assertThatThrownBy(() -> couponManageRepository.queueSize(null)) - .isInstanceOf(NullPointerException.class); - } - @DisplayName("쿠폰 대기열을 성공적으로 삭제한다. - Void") @Test void deleteQueue_success() { diff --git a/src/test/java/com/moabam/api/infrastructure/redis/ZSetRedisRepositoryTest.java b/src/test/java/com/moabam/api/infrastructure/redis/ZSetRedisRepositoryTest.java index 2b5e60e2..0411008f 100644 --- a/src/test/java/com/moabam/api/infrastructure/redis/ZSetRedisRepositoryTest.java +++ b/src/test/java/com/moabam/api/infrastructure/redis/ZSetRedisRepositoryTest.java @@ -106,18 +106,4 @@ void range_less_success() { // Then assertThat(actual).hasSize(3); } - - @DisplayName("저장된 데이터 갯수를 조회한다. - Long") - @Test - void size_success() { - // Given - zSetRedisRepository.addIfAbsent(key, value + 1, 1, expireDays); - zSetRedisRepository.addIfAbsent(key, value + 2, 2, expireDays); - - // When - Long actual = zSetRedisRepository.size(key); - - // Then - assertThat(actual).isEqualTo(2); - } }