|
8 | 8 | import com.somemore.domains.recruitboard.dto.response.RecruitBoardWithLocationResponseDto; |
9 | 9 | import com.somemore.domains.recruitboard.usecase.RecruitBoardQueryUseCase; |
10 | 10 | import com.somemore.support.ControllerTestSupport; |
| 11 | +import com.somemore.support.annotation.MockUser; |
11 | 12 | import org.junit.jupiter.api.DisplayName; |
12 | 13 | import org.junit.jupiter.api.Test; |
13 | 14 | import org.springframework.boot.test.mock.mockito.MockBean; |
@@ -141,9 +142,34 @@ void getRecruitBoardsByCenterId() throws Exception { |
141 | 142 | .accept(MediaType.APPLICATION_JSON)) |
142 | 143 | .andExpect(status().isOk()) |
143 | 144 | .andExpect(jsonPath("$.data").exists()) |
144 | | - .andExpect(jsonPath("$.message").value("기관 봉사 활동 모집글 조회 성공")); |
| 145 | + .andExpect(jsonPath("$.message").value("특정 기관 봉사 활동 모집글 조회 성공")); |
145 | 146 |
|
146 | 147 | verify(recruitBoardQueryUseCase, times(1)).getRecruitBoardsByCenterId(eq(centerId), |
147 | 148 | any(RecruitBoardSearchCondition.class)); |
148 | 149 | } |
| 150 | + |
| 151 | + @MockUser(role = "ROLE_CENTER") |
| 152 | + @DisplayName("본인(기관)이 작성한 게시글 리스트를 조회할 수 있다.") |
| 153 | + @Test |
| 154 | + void getMyRecruitBoards() throws Exception { |
| 155 | + // given |
| 156 | + Page<RecruitBoardResponseDto> page = new PageImpl<>(Collections.emptyList()); |
| 157 | + |
| 158 | + given(recruitBoardQueryUseCase.getRecruitBoardsByCenterId(any(), |
| 159 | + any(RecruitBoardSearchCondition.class))) |
| 160 | + .willReturn(page); |
| 161 | + |
| 162 | + // when |
| 163 | + // then |
| 164 | + mockMvc.perform(get("/api/recruit-boards/me") |
| 165 | + .param("keyword", "volunteer") |
| 166 | + .param("category", ADMINISTRATIVE_SUPPORT.name()) |
| 167 | + .accept(MediaType.APPLICATION_JSON)) |
| 168 | + .andExpect(status().isOk()) |
| 169 | + .andExpect(jsonPath("$.data").exists()) |
| 170 | + .andExpect(jsonPath("$.message").value("기관 봉사 활동 모집글 조회 성공")); |
| 171 | + |
| 172 | + verify(recruitBoardQueryUseCase, times(1)) |
| 173 | + .getRecruitBoardsByCenterId(any(), any(RecruitBoardSearchCondition.class)); |
| 174 | + } |
149 | 175 | } |
0 commit comments