Skip to content

Commit 7a5c027

Browse files
committed
test(community): 게시글, 댓글 Fixture 생성
1 parent 3a1caba commit 7a5c027

File tree

2 files changed

+83
-0
lines changed

2 files changed

+83
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
package com.somemore.common.fixture;
2+
3+
import com.somemore.community.domain.CommunityBoard;
4+
5+
import java.util.UUID;
6+
7+
public class CommunityBoardFixture {
8+
9+
public static final String TITLE = "테스트 커뮤니티 게시글 제목";
10+
public static final String CONTENT = "테스트 커뮤니티 게시글 내용";
11+
public static final String IMG_URL = "http://community.example.com/123";
12+
13+
private CommunityBoardFixture() {
14+
15+
}
16+
17+
public static CommunityBoard createCommunityBoard() {
18+
return CommunityBoard.builder()
19+
.title(TITLE)
20+
.content(CONTENT)
21+
.imgUrl(IMG_URL)
22+
.writerId(UUID.randomUUID())
23+
.build();
24+
}
25+
26+
public static CommunityBoard createCommunityBoard(UUID writerId) {
27+
return CommunityBoard.builder()
28+
.title(TITLE)
29+
.content(CONTENT)
30+
.imgUrl(IMG_URL)
31+
.writerId(writerId)
32+
.build();
33+
}
34+
public static CommunityBoard createCommunityBoard(String title, UUID writerId) {
35+
return CommunityBoard.builder()
36+
.title(title)
37+
.content(CONTENT)
38+
.imgUrl(IMG_URL)
39+
.writerId(writerId)
40+
.build();
41+
}
42+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
package com.somemore.common.fixture;
2+
3+
import com.somemore.community.domain.CommunityComment;
4+
5+
import java.util.UUID;
6+
7+
public class CommunityCommentFixture {
8+
9+
public static final String CONTENT = "커뮤니티 댓글 테스트 내용";
10+
11+
private CommunityCommentFixture() {
12+
13+
}
14+
15+
public static CommunityComment createCommunityComment(Long communityBoardId, UUID writerId) {
16+
return CommunityComment.builder()
17+
.communityBoardId(communityBoardId)
18+
.content(CONTENT)
19+
.writerId(writerId)
20+
.parentCommentId(null)
21+
.build();
22+
}
23+
24+
public static CommunityComment createCommunityComment(Long communityBoardId, UUID wrtierId, Long parentCommentId) {
25+
return CommunityComment.builder()
26+
.communityBoardId(communityBoardId)
27+
.content(CONTENT)
28+
.writerId(wrtierId)
29+
.parentCommentId(parentCommentId)
30+
.build();
31+
}
32+
33+
public static CommunityComment createCommunityComment(String content, Long communityBoardId, UUID writerId) {
34+
return CommunityComment.builder()
35+
.communityBoardId(communityBoardId)
36+
.content(content)
37+
.writerId(writerId)
38+
.parentCommentId(null)
39+
.build();
40+
}
41+
}

0 commit comments

Comments
 (0)