Skip to content

Commit e585fdd

Browse files
committed
[#52] feat: 요정 컨트롤러 테스트 수정
- 누락된 req param 추가 - 응답에 대한 이해를 돕기 위해 리스트 응답에 2개 이상의 요소를 추가
1 parent 9812e76 commit e585fdd

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed

src/test/java/com/nexters/teamace/fairy/presentation/FairyBookControllerTest.java

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,23 @@ void getFairyBook_success() throws Exception {
3838
given(authUserArgumentResolver.resolveArgument(any(), any(), any(), any()))
3939
.willReturn(new UserInfo(1L, "test-user", "테스트유저"));
4040

41-
Fairy fairy = new Fairy(1L, "눈물방울 요정", "sad.png", "sad_sil.png", 1L);
42-
FairyBookEntry fairyBookEntry = new FairyBookEntry(fairy, true);
43-
FairyBook fairyBook = new FairyBook(List.of(fairyBookEntry));
41+
FairyBook fairyBook =
42+
new FairyBook(
43+
List.of(
44+
new FairyBookEntry(
45+
new Fairy(1L, "눈물방울 요정", "sad.png", "sad_sil.png", 1L),
46+
true),
47+
new FairyBookEntry(
48+
new Fairy(2L, "화르르 요정", "anger.png", "anger_sil.png", 2L),
49+
false),
50+
new FairyBookEntry(
51+
new Fairy(
52+
3L,
53+
"질투쟁이 요정",
54+
"jealousy.png",
55+
"jealousy_sil.png",
56+
3L),
57+
true)));
4458

4559
given(fairyService.getFairyBook(any(Long.class))).willReturn(fairyBook);
4660

src/test/java/com/nexters/teamace/fairy/presentation/FairyControllerTest.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.nexters.teamace.fairy.presentation;
22

3+
import static com.epages.restdocs.apispec.ResourceDocumentation.parameterWithName;
34
import static com.epages.restdocs.apispec.ResourceDocumentation.resource;
45
import static com.epages.restdocs.apispec.Schema.schema;
56
import static org.hamcrest.Matchers.equalTo;
@@ -40,7 +41,10 @@ void getFairy_success() throws Exception {
4041
.willReturn(new UserInfo(1L, "test-user", "테스트유저"));
4142

4243
List<FairyInfo> fairyInfos =
43-
List.of(new FairyInfo(1L, "눈물방울 요정", "sad.png", "sad_sil.png", "슬픔"));
44+
List.of(
45+
new FairyInfo(1L, "눈물방울 요정", "sadness.png", "sadness_sil.png", "슬픔"),
46+
new FairyInfo(2L, "화르르 요정", "anger.png", "anger_sil.png", "분노"),
47+
new FairyInfo(3L, "질투쟁이 요정", "jealousy.png", "jealousy_sil.png", "질투"));
4448
FairyResult fairyResult = new FairyResult(fairyInfos);
4549

4650
given(fairyService.getFairy(any(UserInfo.class), any(Long.class))).willReturn(fairyResult);
@@ -67,6 +71,9 @@ void getFairy_success() throws Exception {
6771
ResourceSnippetParameters.builder()
6872
.tag("Fairy")
6973
.description("채팅방 기반 요정 추천 조회")
74+
.queryParameters(
75+
parameterWithName("chatRoomId")
76+
.description("채팅방 ID"))
7077
.responseFields(
7178
fieldWithPath("success")
7279
.type(JsonFieldType.BOOLEAN)

0 commit comments

Comments
 (0)