Skip to content

Commit 117c883

Browse files
committed
test(search): test 수정
1 parent 20ceb93 commit 117c883

File tree

3 files changed

+47
-47
lines changed

3 files changed

+47
-47
lines changed

src/test/java/com/somemore/community/service/board/CommunityBoardDocumentServiceTest.java

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -51,33 +51,33 @@ void tearDown() {
5151
communityBoardRepository.deleteAllInBatch();
5252
}
5353

54-
@DisplayName("검색 키워드가 포함된 게시글을 조회한다. (service)")
55-
@Test
56-
void getCommunityBoardBySearch() {
57-
//given
58-
//when
59-
Page<CommunityBoardResponseDto> dtos = communityBoardDocumentService.getCommunityBoardBySearch("봉사", 0);
60-
61-
//then
62-
assertThat(dtos).isNotNull();
63-
assertThat(dtos.getContent()).isNotNull();
64-
assertThat(dtos.getTotalElements()).isEqualTo(10);
65-
assertThat(dtos.getSize()).isEqualTo(10);
66-
assertThat(dtos.getTotalPages()).isEqualTo(1);
67-
}
68-
69-
// @DisplayName("검색 키워드 없이 조회시 전체 게시글을 조회한다. (service)")
54+
// @DisplayName("검색 키워드가 포함된 게시글을 조회한다. (service)")
7055
// @Test
71-
// void getCommunityBoardBySearchWithNull() {
56+
// void getCommunityBoardBySearch() {
7257
// //given
7358
// //when
74-
// Page<CommunityBoardResponseDto> dtos = communityBoardDocumentService.getCommunityBoardBySearch("", 0);
59+
// Page<CommunityBoardResponseDto> dtos = communityBoardDocumentService.getCommunityBoardBySearch("봉사", 0);
7560
//
7661
// //then
7762
// assertThat(dtos).isNotNull();
7863
// assertThat(dtos.getContent()).isNotNull();
79-
// assertThat(dtos.getTotalElements()).isEqualTo(15);
64+
// assertThat(dtos.getTotalElements()).isEqualTo(10);
8065
// assertThat(dtos.getSize()).isEqualTo(10);
81-
// assertThat(dtos.getTotalPages()).isEqualTo(2);
66+
// assertThat(dtos.getTotalPages()).isEqualTo(1);
8267
// }
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(17);
80+
assertThat(dtos.getSize()).isEqualTo(10);
81+
assertThat(dtos.getTotalPages()).isEqualTo(2);
82+
}
8383
}

src/test/java/com/somemore/community/service/board/CommunityBoardQueryServiceTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ void saveCommunityBoardDocuments() {
169169

170170
assertThat(dtos).isNotNull();
171171
assertThat(dtos.getContent()).isNotNull();
172-
assertThat(dtos.getTotalElements()).isEqualTo(16);
172+
assertThat(dtos.getTotalElements()).isEqualTo(17);
173173
assertThat(dtos.getSize()).isEqualTo(10);
174174
assertThat(dtos.getTotalPages()).isEqualTo(2);
175175

src/test/java/com/somemore/recruitboard/service/query/RecruitBoardDocumentServiceTest.java

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -60,34 +60,13 @@ public void setUp() {
6060
recruitBoardRepository.saveAll(boards);
6161
}
6262

63-
@DisplayName("검색 키워드가 포함된 모집글을 조회한다. (service)")
64-
@Test
65-
void getRecruitBoardBySearch() {
66-
//given
67-
Pageable pageable = getPageable();
68-
RecruitBoardSearchCondition condition = RecruitBoardSearchCondition.builder()
69-
.keyword("노인")
70-
.pageable(pageable)
71-
.build();
72-
73-
//when
74-
Page<RecruitBoardWithCenterResponseDto> dtos = recruitBoardDocumentService.getRecruitBoardBySearch(condition);
75-
76-
//then
77-
assertThat(dtos).isNotNull();
78-
assertThat(dtos.getContent()).isNotNull();
79-
assertThat(dtos.getTotalElements()).isEqualTo(4);
80-
assertThat(dtos.getSize()).isEqualTo(5);
81-
assertThat(dtos.getTotalPages()).isEqualTo(1);
82-
}
83-
84-
// @DisplayName("키워드 없이 검색시 전체 모집글을 조회한다. (service)")
63+
// @DisplayName("검색 키워드가 포함된 모집글을 조회한다. (service)")
8564
// @Test
86-
// void getRecruitBoardBySearchWithNull() {
65+
// void getRecruitBoardBySearch() {
8766
// //given
8867
// Pageable pageable = getPageable();
8968
// RecruitBoardSearchCondition condition = RecruitBoardSearchCondition.builder()
90-
// .keyword("")
69+
// .keyword("노인")
9170
// .pageable(pageable)
9271
// .build();
9372
//
@@ -97,11 +76,32 @@ void getRecruitBoardBySearch() {
9776
// //then
9877
// assertThat(dtos).isNotNull();
9978
// assertThat(dtos.getContent()).isNotNull();
100-
// assertThat(dtos.getTotalElements()).isEqualTo(23);
79+
// assertThat(dtos.getTotalElements()).isEqualTo(4);
10180
// assertThat(dtos.getSize()).isEqualTo(5);
102-
// assertThat(dtos.getTotalPages()).isEqualTo(5);
81+
// assertThat(dtos.getTotalPages()).isEqualTo(1);
10382
// }
10483

84+
@DisplayName("키워드 없이 검색시 전체 모집글을 조회한다. (service)")
85+
@Test
86+
void getRecruitBoardBySearchWithNull() {
87+
//given
88+
Pageable pageable = getPageable();
89+
RecruitBoardSearchCondition condition = RecruitBoardSearchCondition.builder()
90+
.keyword("")
91+
.pageable(pageable)
92+
.build();
93+
94+
//when
95+
Page<RecruitBoardWithCenterResponseDto> dtos = recruitBoardDocumentService.getRecruitBoardBySearch(condition);
96+
97+
//then
98+
assertThat(dtos).isNotNull();
99+
assertThat(dtos.getContent()).isNotNull();
100+
assertThat(dtos.getTotalElements()).isEqualTo(30);
101+
assertThat(dtos.getSize()).isEqualTo(5);
102+
assertThat(dtos.getTotalPages()).isEqualTo(6);
103+
}
104+
105105
// @DisplayName("위치 기반으로 주변 모집글을 페이징하여 조회할 수 있다. (service)")
106106
// @Test
107107
// void getRecruitBoardsNearBy() {

0 commit comments

Comments
 (0)