-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* test: ChatRoomTest Fixture 추가 및 테스트 케이스 리팩토링 * test: JpaChatRoomRepositoryTest Fixture 추가 및 테스트 케이스 리팩토링 * test: QuerydslChatRoomRepositoryImplTest Fixture 추가 및 테스트 케이스 리팩토링 * test: QuerydslChatRoomAndImageRepositoryImplTest Fixture 추가 및 테스트 케이스 리팩토링 * test: QuerydslChatRoomAndMessageAndImageRepositoryImplTest Fixture 추가 및 테스트 케이스 리팩토링 * test: ChatRoomServiceTest Fixture 추가 및 테스트 케이스 리팩토링 * test: 모든 픽스처 객체를 `@BeforeEach`로 세팅하도록 변경 * test: 테스트 픽스처 추가 및 코드 리팩토링 * test: 서비스의 반환 값도 픽스처를 사용해서 비교하도록 수정 * stule: 개행 수정 및 사용하지 않는 필드 제거 * test: 픽스처 클래스 필드 중 사용하지 않는 필드 정리
- Loading branch information
1 parent
2e3c5c8
commit dddceb8
Showing
12 changed files
with
893 additions
and
1,297 deletions.
There are no files selected for viewing
709 changes: 28 additions & 681 deletions
709
backend/ddang/src/test/java/com/ddang/ddang/chat/application/ChatRoomServiceTest.java
Large diffs are not rendered by default.
Oops, something went wrong.
250 changes: 250 additions & 0 deletions
250
.../ddang/src/test/java/com/ddang/ddang/chat/application/fixture/ChatRoomServiceFixture.java
Large diffs are not rendered by default.
Oops, something went wrong.
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
63 changes: 63 additions & 0 deletions
63
backend/ddang/src/test/java/com/ddang/ddang/chat/domain/fixture/ChatRoomFixture.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,63 @@ | ||
package com.ddang.ddang.chat.domain.fixture; | ||
|
||
import com.ddang.ddang.auction.domain.Auction; | ||
import com.ddang.ddang.auction.domain.BidUnit; | ||
import com.ddang.ddang.auction.domain.Price; | ||
import com.ddang.ddang.bid.domain.Bid; | ||
import com.ddang.ddang.bid.domain.BidPrice; | ||
import com.ddang.ddang.category.domain.Category; | ||
import com.ddang.ddang.image.domain.ProfileImage; | ||
import com.ddang.ddang.user.domain.User; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.springframework.test.util.ReflectionTestUtils; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
@SuppressWarnings("NonAsciiCharacters") | ||
public class ChatRoomFixture { | ||
|
||
protected User 판매자; | ||
protected User 구매자; | ||
protected User 경매에_참여하지_않는_사용자; | ||
protected Auction 경매; | ||
protected Bid 입찰; | ||
|
||
@BeforeEach | ||
void setUp() { | ||
판매자 = User.builder() | ||
.name("판매자") | ||
.profileImage(new ProfileImage("upload.png", "store.png")) | ||
.reliability(4.7d) | ||
.oauthId("12345") | ||
.build(); | ||
구매자 = User.builder() | ||
.name("구매자") | ||
.profileImage(new ProfileImage("upload.png", "store.png")) | ||
.reliability(4.7d) | ||
.oauthId("12346") | ||
.build(); | ||
경매에_참여하지_않는_사용자 = User.builder() | ||
.name("경매에 참여하지 않는 사용자") | ||
.profileImage(new ProfileImage("upload.png", "store.png")) | ||
.reliability(4.7d) | ||
.oauthId("12347") | ||
.build(); | ||
|
||
경매 = Auction.builder() | ||
.seller(판매자) | ||
.title("맥북") | ||
.description("맥북 팔아요") | ||
.subCategory(new Category("전자기기")) | ||
.startPrice(new Price(10_000)) | ||
.bidUnit(new BidUnit(1_000)) | ||
.closingTime(LocalDateTime.now()) | ||
.build(); | ||
입찰 = new Bid(경매, 구매자, new BidPrice(15_000)); | ||
|
||
ReflectionTestUtils.setField(판매자, "id", 1L); | ||
ReflectionTestUtils.setField(구매자, "id", 2L); | ||
ReflectionTestUtils.setField(경매에_참여하지_않는_사용자, "id", 3L); | ||
|
||
경매.updateLastBid(입찰); | ||
} | ||
} |
Oops, something went wrong.