Skip to content

Commit

Permalink
fix: MyCommentCafeResponse에서의 comments 필드명 변경 (#141)
Browse files Browse the repository at this point in the history
* style: modify MyCommentCafeResponse fileName

* style: delete unused code
  • Loading branch information
Ji-soo708 authored Dec 9, 2023
1 parent d2216f2 commit 0dbdf7a
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
package mocacong.server.dto.response;

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

import lombok.*;

import mocacong.server.domain.Cafe;
import mocacong.server.domain.Comment;

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

@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor
Expand All @@ -18,7 +17,7 @@ public class MyCommentCafeResponse {
private String name;
private String studyType;
private String roadAddress;
private List<String> comments;
private List<String> commentContents;

public static MyCommentCafeResponse of(Cafe cafe, List<Comment> comments) {
List<String> contents = comments.stream()
Expand Down
1 change: 0 additions & 1 deletion src/main/java/mocacong/server/service/CafeService.java
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ public MyCommentCafesResponse findMyCommentCafes(Long memberId, int page, int co
List<Comment> comments = commentRepository.findAllByMemberId(member.getId());

List<MyCommentCafeResponse> responses = comments.stream()
// .map(MyCommentCafeResponse::from)
.collect(Collectors.groupingByConcurrent(Comment::getCafe))
.entrySet()
.stream()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
package mocacong.server.acceptance;

import io.restassured.RestAssured;
import static mocacong.server.acceptance.AcceptanceFixtures.*;
import mocacong.server.domain.Platform;
import mocacong.server.domain.cafedetail.StudyType;
import mocacong.server.dto.request.*;
import mocacong.server.dto.response.*;
import mocacong.server.security.auth.OAuthPlatformMemberResponse;
import mocacong.server.security.auth.apple.AppleOAuthUserProvider;
import mocacong.server.support.AwsSESSender;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;

import static mocacong.server.acceptance.AcceptanceFixtures.*;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.jupiter.api.Assertions.assertAll;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.when;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;

public class MemberAcceptanceTest extends AcceptanceTest {

Expand Down Expand Up @@ -399,7 +399,7 @@ void findMyCommentCafes() {

assertAll(
()->assertThat(response.getCafes()).hasSize(2),
()->assertThat(response.getCafes().get(0).getComments()).containsExactlyInAnyOrder("댓글3")
()->assertThat(response.getCafes().get(0).getCommentContents()).containsExactlyInAnyOrder("댓글3")
);
}

Expand Down
4 changes: 2 additions & 2 deletions src/test/java/mocacong/server/service/CafeServiceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -490,8 +490,8 @@ void findMyCommentCafes() {
() -> assertThat(actual.getIsEnd()).isTrue(),
// 댓글 수는 3개지만, 카페 종류가 2종류이므로 response size는 2개
() -> assertThat(actual.getCafes()).hasSize(2),
() -> assertThat(actual.getCafes().get(0).getComments()).containsExactlyInAnyOrder("댓글1", "댓글2"),
() -> assertThat(actual.getCafes().get(1).getComments()).containsExactlyInAnyOrder("댓글3")
() -> assertThat(actual.getCafes().get(0).getCommentContents()).containsExactlyInAnyOrder("댓글1", "댓글2"),
() -> assertThat(actual.getCafes().get(1).getCommentContents()).containsExactlyInAnyOrder("댓글3")
);
}

Expand Down

0 comments on commit 0dbdf7a

Please sign in to comment.