-
Notifications
You must be signed in to change notification settings - Fork 1
Feature/79 리뷰 등록 #100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Feature/79 리뷰 등록 #100
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
cdc54c3
feat(volunteer-apply): 기본 엔티티 레포지토리 추가
leebs0521 9b79ce5
feat(volunteer-apply): 기본 엔티티 레포지토리 테스트
leebs0521 119b1d1
feat(volunteer-apply): 리뷰 생성에 필요한 조회 기능 추가
leebs0521 89e5040
test(volunteer-apply): 리뷰 생성에 필요한 조회 기능 테스트
leebs0521 5035834
feat(review): 리뷰 엔티티 레포지토리 생성
leebs0521 a2389e7
test(review): 리뷰 엔티티 레포지토리 테스트
leebs0521 e5ce817
feat(review): 리뷰 생성 기능 추가
leebs0521 98b2000
test(review): 리뷰 생성 기능 테스트
leebs0521 a02d3b1
fix: conflict remove
leebs0521 caa94f1
refactor: 불필요한 import 제거
leebs0521 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
62 changes: 62 additions & 0 deletions
62
src/test/java/com/somemore/review/repository/ReviewRepositoryImplTest.java
This file contains hidden or 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,62 @@ | ||
| package com.somemore.review.repository; | ||
|
|
||
| import static org.assertj.core.api.Assertions.assertThat; | ||
|
|
||
| import com.somemore.IntegrationTestSupport; | ||
| import com.somemore.review.domain.Review; | ||
| import java.util.Optional; | ||
| import java.util.UUID; | ||
| 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; | ||
|
|
||
| @Transactional | ||
| class ReviewRepositoryImplTest extends IntegrationTestSupport { | ||
|
|
||
| @Autowired | ||
| private ReviewRepositoryImpl reviewRepository; | ||
|
|
||
| @DisplayName("리뷰 생성 및 조회") | ||
| @Test | ||
| void saveAndFind() { | ||
| // given | ||
| Review review = Review.builder() | ||
| .volunteerApplyId(1L) | ||
| .volunteerId(UUID.randomUUID()) | ||
| .title("리뷰 제목") | ||
| .content("리뷰 내용") | ||
| .imgUrl("") | ||
| .build(); | ||
| reviewRepository.save(review); | ||
|
|
||
| // when | ||
| Optional<Review> findReview = reviewRepository.findById(review.getId()); | ||
|
|
||
| // then | ||
| assertThat(findReview).isPresent(); | ||
| assertThat(findReview.get().getId()).isEqualTo(review.getId()); | ||
| } | ||
|
|
||
| @DisplayName("봉사 지원 아이디로 리뷰 존재 유무를 확인할 수 있다") | ||
| @Test | ||
| void existsByVolunteerApplyId() { | ||
| // given | ||
| Long volunteerApplyId = 1L; | ||
| Review review = Review.builder() | ||
| .volunteerApplyId(volunteerApplyId) | ||
| .volunteerId(UUID.randomUUID()) | ||
| .title("리뷰 제목") | ||
| .content("리뷰 내용") | ||
| .imgUrl("") | ||
| .build(); | ||
| reviewRepository.save(review); | ||
|
|
||
| // when | ||
| boolean result = reviewRepository.existsByVolunteerApplyId(volunteerApplyId); | ||
|
|
||
| // then | ||
| assertThat(result).isTrue(); | ||
| } | ||
|
|
||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.