Skip to content

Commit 4982834

Browse files
committed
test(CreateRecruitBoardMessageConverterTest): 메시지 컨버팅 테스트 추가
1 parent 9a4f6cd commit 4982834

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
package com.somemore.interestcenter.converter;
2+
3+
import com.somemore.IntegrationTestSupport;
4+
import com.somemore.global.common.event.DomainEventSubType;
5+
import com.somemore.global.common.event.ServerEventType;
6+
import com.somemore.recruitboard.event.CreateRecruitBoardEvent;
7+
import org.junit.jupiter.api.DisplayName;
8+
import org.junit.jupiter.api.Test;
9+
import org.springframework.beans.factory.annotation.Autowired;
10+
11+
import java.util.UUID;
12+
13+
import static org.assertj.core.api.Assertions.assertThat;
14+
15+
class CreateRecruitBoardMessageConverterTest extends IntegrationTestSupport {
16+
17+
@Autowired
18+
private CreateRecruitBoardMessageConverter createRecruitBoardMessageConverter;
19+
20+
@Test
21+
@DisplayName("CREATE_RECRUIT_BOARD 메시지를 변환하면 CreateRecruitBoardEvent 객체를 반환한다")
22+
void testVolunteerReviewRequestConversion() {
23+
// given
24+
String message = """
25+
{
26+
"type": "DOMAIN_EVENT",
27+
"subType": "CREATE_RECRUIT_BOARD",
28+
"centerId": "123e4567-e89b-12d3-a456-426614174001",
29+
"recruitBoardId": 456,
30+
"createdAt": "2024-12-05T10:00:00"
31+
}
32+
""";
33+
34+
// when
35+
CreateRecruitBoardEvent event = createRecruitBoardMessageConverter.from(message);
36+
37+
// then
38+
assertThat(event.getCenterId()).isEqualTo(UUID.fromString("123e4567-e89b-12d3-a456-426614174001"));
39+
assertThat(event.getRecruitBoardId()).isEqualTo(456);
40+
assertThat(event.getType()).isEqualTo(ServerEventType.DOMAIN_EVENT);
41+
assertThat(event.getSubType()).isEqualTo(DomainEventSubType.CREATE_RECRUIT_BOARD);
42+
}
43+
44+
}

0 commit comments

Comments
 (0)