Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeywordResponse에서 추천 포스트 emptyList 반환 로직 제거 #1543

Merged
merged 1 commit into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@
import java.util.Arrays;
import java.util.HashSet;

import static java.util.Collections.emptyList;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.doNothing;
import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document;

@WebMvcTest(controllers = KeywordController.class)
public class KeywordDocumentation extends NewDocumentation {
class KeywordDocumentation extends NewDocumentation {

@MockBean
private KeywordService keywordService;
Expand Down Expand Up @@ -148,7 +149,10 @@ public class KeywordDocumentation extends NewDocumentation {
"자바의 자료구조인 List에 대한 설명을 작성했습니다.",
1,
1,
0,
0,
1L,
emptyList(),
null
),
new KeywordResponse(
Expand All @@ -157,7 +161,10 @@ public class KeywordDocumentation extends NewDocumentation {
"자바의 자료구조인 Set에 대한 설명을 작성했습니다.",
2,
1,
0,
0,
1L,
emptyList(),
null
))
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,11 @@
import lombok.NoArgsConstructor;
import wooteco.prolog.roadmap.domain.Keyword;

import java.util.Collections;
import java.util.HashSet;
import java.util.Set;

import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

import static java.util.Collections.*;

@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Getter
public class KeywordResponse {
Expand Down Expand Up @@ -48,13 +42,6 @@ public KeywordResponse(final Long keywordId, final String name, final String des
this.childrenKeywords = childrenKeywords;
}

public KeywordResponse(final Long keywordId, final String name, final String description,
final int order,
final int importance, final Long parentKeywordId,
final Set<KeywordResponse> childrenKeywords) {
this(keywordId, name, description, order, importance, 0, 0, parentKeywordId, emptyList(), childrenKeywords);
}

public static KeywordResponse createResponse(final Keyword keyword) {
return new KeywordResponse(
keyword.getId(),
Expand All @@ -81,7 +68,10 @@ public static KeywordResponse createWithAllChildResponse(final Keyword keyword)
keyword.getDescription(),
keyword.getSeq(),
keyword.getImportance(),
0,
0,
keyword.getParentIdOrNull(),
createRecommendedPostResponses(keyword),
createChildren(keyword.getChildren()));
}

Expand Down