-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #176 from Team-BC-1/fix/like-product
중복된 관심상품 등록요청에 대한 검증처리
- Loading branch information
Showing
11 changed files
with
89 additions
and
19 deletions.
There are no files selected for viewing
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
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
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
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
53 changes: 53 additions & 0 deletions
53
...test/java/bc1/gream/domain/product/service/command/ProductLikeServiceIntegrationTest.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,53 @@ | ||
package bc1.gream.domain.product.service.command; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
import bc1.gream.domain.product.entity.Product; | ||
import bc1.gream.domain.product.repository.LikeProductRepository; | ||
import bc1.gream.domain.user.entity.User; | ||
import bc1.gream.test.BaseIntegrationTest; | ||
import bc1.gream.test.ProductTest; | ||
import bc1.gream.test.UserTest; | ||
import org.junit.jupiter.api.AfterEach; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Disabled; | ||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
@Disabled("통합테스트는 로컬에서만 실행합니다. 실행 시, SECRET KEY 에 대한 IntelliJ 환경변수를 설정해주어야 합니다.") | ||
@Transactional | ||
class ProductLikeServiceIntegrationTest extends BaseIntegrationTest implements ProductTest, UserTest { | ||
|
||
@Autowired | ||
private ProductLikeService productLikeService; | ||
@Autowired | ||
private LikeProductRepository likeProductRepository; | ||
|
||
@BeforeEach | ||
void setUp() { | ||
setUpBaseIntegrationTest(); | ||
} | ||
|
||
@AfterEach | ||
void tearDown() { | ||
tearDownBaseIntegrationTest(); | ||
} | ||
|
||
@Test | ||
@DisplayName("중복된 관심상품 요청을 검증합니다.") | ||
public void 중복된_관심상품_요청검증() { | ||
// GIVEN | ||
Product product = savedIcedAmericano; | ||
User user = savedBuyer; | ||
|
||
// WHEN | ||
productLikeService.likeProduct(user, product.getId()); | ||
|
||
// THEN | ||
boolean hasNotLikedThisProduct = user.getLikeProducts().stream() | ||
.noneMatch(likeProduct -> likeProduct.getProduct().equals(product)); | ||
assertTrue(hasNotLikedThisProduct); | ||
} | ||
} |
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
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