Skip to content

Commit

Permalink
refactor: 사용하지 않는 불필요 메서드 제거
Browse files Browse the repository at this point in the history
  • Loading branch information
hyeonic committed Oct 8, 2022
1 parent 4eccd75 commit 87b4796
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ public interface SubscriptionRepository extends JpaRepository<Subscription, Long
@EntityGraph(attributePaths = {"category", "category.member"})
List<Subscription> findByCategoryId(final Long categoryId);

List<Subscription> findByMemberIdIn(final List<Long> memberIds);

void deleteByCategoryIdIn(final List<Long> categoryIds);

default Subscription getById(final Long id) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import static com.allog.dallog.common.fixtures.CategoryFixtures.FE_일정;
import static com.allog.dallog.common.fixtures.CategoryFixtures.공통_일정;
import static com.allog.dallog.common.fixtures.MemberFixtures.관리자;
import static com.allog.dallog.common.fixtures.MemberFixtures.리버;
import static com.allog.dallog.common.fixtures.MemberFixtures.매트;
import static com.allog.dallog.common.fixtures.MemberFixtures.파랑;
import static com.allog.dallog.common.fixtures.MemberFixtures.후디;
Expand All @@ -23,8 +22,6 @@
import com.allog.dallog.domain.subscription.exception.ExistSubscriptionException;
import com.allog.dallog.domain.subscription.exception.NoSuchSubscriptionException;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down Expand Up @@ -138,47 +135,6 @@ class SubscriptionRepositoryTest extends RepositoryTest {
assertThat(subscriptions).isEmpty();
}

@DisplayName("member id 리스트를 기반으로 구독 정보를 조회한다.")
@Test
void member_id_리스트를_기반으로_구독_정보를_조회한다() {
// given
Member 관리자 = memberRepository.save(관리자());
Category 공통_일정 = categoryRepository.save(공통_일정(관리자));

Member 매트 = memberRepository.save(매트());
Member 리버 = memberRepository.save(리버());
Member 파랑 = memberRepository.save(파랑());
Member 후디 = memberRepository.save(후디());

subscriptionRepository.save(색상1_구독(매트, 공통_일정));
subscriptionRepository.save(색상1_구독(리버, 공통_일정));
subscriptionRepository.save(색상1_구독(파랑, 공통_일정));
subscriptionRepository.save(색상1_구독(후디, 공통_일정));

List<Long> memberIds = Stream.of(매트, 리버, 파랑, 후디)
.map(Member::getId)
.collect(Collectors.toList());

// when
List<Subscription> actual = subscriptionRepository.findByMemberIdIn(memberIds);

// then
assertThat(actual).hasSize(4);
}

@DisplayName("member id 리스트가 비어있는 경우 빈 리스트를 반환한다.")
@Test
void member_id_리스트가_비어있는_경우__리스트를_반환한다() {
// given
List<Long> memberIds = List.of();

// when
List<Subscription> actual = subscriptionRepository.findByMemberIdIn(memberIds);

// then
assertThat(actual).isEmpty();
}

@DisplayName("특정 카테고리들에 속한 구독을 전부 삭제한다")
@Test
void 특정_카테고리들에_속한_구독을_전부_삭제한다() {
Expand Down

0 comments on commit 87b4796

Please sign in to comment.