-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
src/test/java/com/moabam/api/domain/coupon/repository/CouponWalletSearchRepositoryTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package com.moabam.api.domain.coupon.repository; | ||
|
||
import static com.moabam.support.fixture.CouponFixture.*; | ||
import static org.assertj.core.api.Assertions.*; | ||
|
||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
|
||
import com.moabam.api.domain.coupon.Coupon; | ||
import com.moabam.api.domain.coupon.CouponWallet; | ||
import com.moabam.support.annotation.QuerydslRepositoryTest; | ||
|
||
@QuerydslRepositoryTest | ||
class CouponWalletSearchRepositoryTest { | ||
|
||
@Autowired | ||
private CouponRepository couponRepository; | ||
|
||
@Autowired | ||
private CouponWalletRepository couponWalletRepository; | ||
|
||
@Autowired | ||
private CouponWalletSearchRepository couponWalletSearchRepository; | ||
|
||
@DisplayName("회원의 특정 쿠폰 지갑을 조회한다.") | ||
@Test | ||
void find_by_id_and_member_id() { | ||
// given | ||
Long id = 1L; | ||
Long memberId = 1L; | ||
Coupon coupon = couponRepository.save(discount1000Coupon()); | ||
couponWalletRepository.save(couponWallet(memberId, coupon)); | ||
|
||
// when | ||
CouponWallet actual = couponWalletSearchRepository.findByIdAndMemberId(id, memberId).orElseThrow(); | ||
|
||
// then | ||
assertThat(actual.getCoupon()).isEqualTo(coupon); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters