-
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
7 changed files
with
10 additions
and
16 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
3 changes: 2 additions & 1 deletion
3
...product/src/main/kotlin/com/commerce/service/product/application/usecase/ReviewUseCase.kt
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 |
---|---|---|
@@ -1,11 +1,12 @@ | ||
package com.commerce.service.product.application.usecase | ||
|
||
import com.commerce.common.model.member.Member | ||
import com.commerce.common.model.review.ReviewWithMember | ||
import com.commerce.common.model.review.ReviewWithProduct | ||
import com.commerce.service.product.application.usecase.command.AddReviewCommand | ||
|
||
interface ReviewUseCase { | ||
fun getProductReviews(productId: Long): List<ReviewWithMember> | ||
fun addReviewToProduct(addReviewCommand: AddReviewCommand): Long | ||
fun addReviewToProduct(member: Member, addReviewCommand: AddReviewCommand): Long | ||
fun getMemberReviews(memberId: Long): List<ReviewWithProduct> | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,7 @@ class ReviewServiceTest { | |
private lateinit var reviewRepository: ReviewRepository | ||
private lateinit var memberRepository: MemberRepository | ||
private val reviewService by lazy { | ||
ReviewService(reviewRepository, memberRepository) | ||
ReviewService(reviewRepository) | ||
} | ||
|
||
@BeforeEach | ||
|
@@ -87,11 +87,10 @@ class ReviewServiceTest { | |
|
||
var addReviewCommand = AddReviewCommand( | ||
productId = 1L, | ||
email = "[email protected]", | ||
content = "재미있는 책이에요", | ||
score = BigDecimal(5), | ||
) | ||
reviewService.addReviewToProduct(addReviewCommand) | ||
reviewService.addReviewToProduct(newMember, addReviewCommand) | ||
|
||
val reviewsByProduct = reviewRepository.findByProductIdOrderByCreatedAtDesc(1L) | ||
|
||
|
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 |
---|---|---|
|
@@ -174,11 +174,11 @@ class ReviewControllerTest( | |
@Test | ||
fun addReviewToProduct() { | ||
given(reviewUseCase.addReviewToProduct( | ||
testMember, | ||
AddReviewCommand( | ||
productId = 1L, | ||
content = "재미있어요!", | ||
score = BigDecimal(5), | ||
email = "[email protected]", | ||
) | ||
)).willReturn(1L) | ||
|
||
|