File tree Expand file tree Collapse file tree 3 files changed +35
-4
lines changed Expand file tree Collapse file tree 3 files changed +35
-4
lines changed Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ void setUp() {
4343
4444 @ DisplayName ("검색 키워드가 포함된 게시글을 조회할 수 있다. (repository)" )
4545 @ Test
46- void findByCommunityBoardsContaining () throws InterruptedException {
46+ void findByCommunityBoardsContaining () {
4747 //given
4848 Pageable pageable = getPageable ();
4949
@@ -57,6 +57,22 @@ void findByCommunityBoardsContaining() throws InterruptedException {
5757 assertThat (findBoards .getTotalPages ()).isEqualTo (1 );
5858 }
5959
60+ // @DisplayName("키워드 없이 검색시 전체 게시글을 조회할 수 있다. (repository)")
61+ // @Test
62+ // void findByCommunityBoardsContainingWithNull() {
63+ // //given
64+ // Pageable pageable = getPageable();
65+ //
66+ // //when
67+ // Page<CommunityBoardView> findBoards = communityBoardRepository.findByCommunityBoardsContaining(null, pageable);
68+ //
69+ // //then
70+ // assertThat(findBoards).isNotNull();
71+ // assertThat(findBoards.getTotalElements()).isEqualTo(16);
72+ // assertThat(findBoards.getSize()).isEqualTo(10);
73+ // assertThat(findBoards.getTotalPages()).isEqualTo(2);
74+ // }
75+
6076 private Pageable getPageable () {
6177 return PageRequest .of (0 , 10 );
6278 }
Original file line number Diff line number Diff line change @@ -65,4 +65,19 @@ void getCommunityBoardBySearch() {
6565 assertThat (dtos .getSize ()).isEqualTo (10 );
6666 assertThat (dtos .getTotalPages ()).isEqualTo (1 );
6767 }
68+
69+ // @DisplayName("검색 키워드 없이 조회시 전체 게시글을 조회한다. (service)")
70+ // @Test
71+ // void getCommunityBoardBySearchWithNull() {
72+ // //given
73+ // //when
74+ // Page<CommunityBoardResponseDto> dtos = communityBoardDocumentService.getCommunityBoardBySearch("", 0);
75+ //
76+ // //then
77+ // assertThat(dtos).isNotNull();
78+ // assertThat(dtos.getContent()).isNotNull();
79+ // assertThat(dtos.getTotalElements()).isEqualTo(15);
80+ // assertThat(dtos.getSize()).isEqualTo(10);
81+ // assertThat(dtos.getTotalPages()).isEqualTo(2);
82+ // }
6883}
Original file line number Diff line number Diff line change @@ -165,13 +165,13 @@ void saveCommunityBoardDocuments() {
165165 communityBoardDocumentService .saveCommunityBoardDocuments (communityBoards );
166166
167167 //then
168- Page <CommunityBoardResponseDto > dtos = communityBoardDocumentService .getCommunityBoardBySearch ("저장 " , 0 );
168+ Page <CommunityBoardResponseDto > dtos = communityBoardDocumentService .getCommunityBoardBySearch ("" , 0 );
169169
170170 assertThat (dtos ).isNotNull ();
171171 assertThat (dtos .getContent ()).isNotNull ();
172- assertThat (dtos .getTotalElements ()).isEqualTo (1 );
172+ assertThat (dtos .getTotalElements ()).isEqualTo (15 );
173173 assertThat (dtos .getSize ()).isEqualTo (10 );
174- assertThat (dtos .getTotalPages ()).isEqualTo (1 );
174+ assertThat (dtos .getTotalPages ()).isEqualTo (2 );
175175
176176 communityBoardRepository .deleteDocument (savedBoard .getId ());
177177 }
You can’t perform that action at this time.
0 commit comments