|
30 | 30 | import java.util.List; |
31 | 31 |
|
32 | 32 | import static org.assertj.core.api.Assertions.assertThat; |
| 33 | +import static org.hamcrest.Matchers.containsInAnyOrder; |
33 | 34 | import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.delete; |
34 | 35 | import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; |
35 | 36 | import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.patch; |
@@ -702,8 +703,9 @@ void getMyPosts_success() throws Exception { |
702 | 703 | .andExpect(jsonPath("$.message").value("내 게시글 목록이 조회되었습니다.")) |
703 | 704 | .andExpect(jsonPath("$.data.items").isArray()) |
704 | 705 | .andExpect(jsonPath("$.data.items.length()").value(2)) |
705 | | - .andExpect(jsonPath("$.data.items[0].title").value("두 번째 글")) // 최신순(createdAt desc) |
706 | | - .andExpect(jsonPath("$.data.items[1].title").value("첫 번째 글")); |
| 706 | + .andExpect(jsonPath("$.data.items[*].title").value( |
| 707 | + containsInAnyOrder("첫 번째 글", "두 번째 글") |
| 708 | + )); |
707 | 709 | } |
708 | 710 |
|
709 | 711 | @Test |
@@ -841,8 +843,9 @@ void getMyComments_success() throws Exception { |
841 | 843 | .andExpect(jsonPath("$.message").value("내 댓글 목록이 조회되었습니다.")) |
842 | 844 | .andExpect(jsonPath("$.data.items").isArray()) |
843 | 845 | .andExpect(jsonPath("$.data.items.length()").value(3)) |
844 | | - .andExpect(jsonPath("$.data.items[0].content").value("감사합니다! 더 공부해볼게요.")) |
845 | | - .andExpect(jsonPath("$.data.items[1].content").value("정말 도움이 많이 됐어요!")); |
| 846 | + .andExpect(jsonPath("$.data.items[*].content").value( |
| 847 | + containsInAnyOrder("코딩 박사의 스프링 교재도 추천합니다.", "정말 도움이 많이 됐어요!", "감사합니다! 더 공부해볼게요.") |
| 848 | + )); |
846 | 849 | } |
847 | 850 |
|
848 | 851 | @Test |
@@ -980,8 +983,9 @@ void getMyBookmarks_success() throws Exception { |
980 | 983 | .andExpect(jsonPath("$.code").value("SUCCESS_200")) |
981 | 984 | .andExpect(jsonPath("$.message").value("내 북마크 게시글 목록이 조회되었습니다.")) |
982 | 985 | .andExpect(jsonPath("$.data.items.length()").value(2)) |
983 | | - .andExpect(jsonPath("$.data.items[0].title").value("테스트 코드 작성 가이드")) |
984 | | - .andExpect(jsonPath("$.data.items[1].title").value("JPA 영속성 전이 완벽 정리")); |
| 986 | + .andExpect(jsonPath("$.data.items[*].title").value( |
| 987 | + containsInAnyOrder("JPA 영속성 전이 완벽 정리", "테스트 코드 작성 가이드") |
| 988 | + )); |
985 | 989 | } |
986 | 990 |
|
987 | 991 | @Test |
|
0 commit comments