Skip to content

Commit 4f044a5

Browse files
committed
test: 솜커톤 참가자 테스트 수정
- SomParticipantServiceTest : isTransferredInCS, isPaid 필드 추가 - 테스트 정상 동작 확인
1 parent 72bbe23 commit 4f044a5

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/test/java/dmu/dasom/api/domain/somkathon/SomParticipantServiceTest.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ void createParticipant_success() {
4444
4545
.githubLink("https://github.com/username")
4646
.portfolioLink("https://drive.google.com/file")
47+
.isTransferredInCS(null) // null 테스트
48+
.isPaid(true) // true 테스트
4749
.build();
4850

4951
when(repository.findByStudentId("20250001")).thenReturn(Optional.empty());
@@ -60,6 +62,8 @@ void createParticipant_success() {
6062
assertEquals("[email protected]", response.getEmail());
6163
assertEquals("https://github.com/username", response.getGithubLink());
6264
assertEquals("https://drive.google.com/file", response.getPortfolioLink());
65+
assertNull(response.getIsTransferredInCS());
66+
assertTrue(response.getIsPaid());
6367

6468
verify(repository, times(1)).findByStudentId("20250001");
6569
verify(repository, times(1)).save(any(SomParticipant.class));
@@ -96,6 +100,8 @@ void getAllParticipants_success() {
96100
97101
.githubLink("https://github.com/hong")
98102
.portfolioLink("https://drive.google.com/file")
103+
.isTransferredInCS(null)
104+
.isPaid(true)
99105
.build();
100106
SomParticipant p2 = SomParticipant.builder()
101107
.participantName("김철수")
@@ -106,6 +112,8 @@ void getAllParticipants_success() {
106112
107113
.githubLink("https://github.com/kim")
108114
.portfolioLink("https://notion.site")
115+
.isTransferredInCS(false)
116+
.isPaid(false)
109117
.build();
110118

111119
when(repository.findAll()).thenReturn(List.of(p1, p2));
@@ -117,6 +125,10 @@ void getAllParticipants_success() {
117125
assertEquals("김철수", list.get(1).getParticipantName());
118126
assertEquals("https://github.com/hong", list.get(0).getGithubLink());
119127
assertEquals("https://notion.site", list.get(1).getPortfolioLink());
128+
assertNull(list.get(0).getIsTransferredInCS());
129+
assertTrue(list.get(0).getIsPaid());
130+
assertFalse(list.get(1).getIsPaid());
131+
assertFalse(list.get(1).getIsTransferredInCS());
120132

121133
verify(repository, times(1)).findAll();
122134
}
@@ -133,6 +145,8 @@ void getParticipant_success() {
133145
134146
.githubLink("https://github.com/username")
135147
.portfolioLink("https://drive.google.com/file")
148+
.isTransferredInCS(true)
149+
.isPaid(false)
136150
.build();
137151

138152
when(repository.findById(1L)).thenReturn(Optional.of(participant));
@@ -141,6 +155,8 @@ void getParticipant_success() {
141155

142156
assertEquals("홍길동", response.getParticipantName());
143157
assertEquals("20250001", response.getStudentId());
158+
assertTrue(response.getIsTransferredInCS());
159+
assertFalse(response.getIsPaid());
144160

145161
verify(repository, times(1)).findById(1L);
146162
}
@@ -171,6 +187,8 @@ void updateParticipant_success() {
171187
172188
.githubLink("https://github.com/username")
173189
.portfolioLink("https://drive.google.com/file")
190+
.isTransferredInCS(false)
191+
.isPaid(false)
174192
.build();
175193

176194
SomParticipantRequestDto updateRequest = SomParticipantRequestDto.builder()
@@ -182,6 +200,8 @@ void updateParticipant_success() {
182200
183201
.githubLink("https://github.com/username2")
184202
.portfolioLink("https://drive.google.com/file2")
203+
.isTransferredInCS(true)
204+
.isPaid(null)
185205
.build();
186206

187207
when(repository.findById(1L)).thenReturn(Optional.of(existing));
@@ -196,6 +216,8 @@ void updateParticipant_success() {
196216
assertEquals("[email protected]", response.getEmail());
197217
assertEquals("https://github.com/username2", response.getGithubLink());
198218
assertEquals("https://drive.google.com/file2", response.getPortfolioLink());
219+
assertTrue(response.getIsTransferredInCS());
220+
assertNull(response.getIsPaid());
199221

200222
verify(repository, times(1)).findById(1L);
201223
}

0 commit comments

Comments
 (0)