-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from jisung-in/talkroom/29-talkRoom-test-api
[Test] TalkRoom API 테스트 수정
- Loading branch information
Showing
10 changed files
with
131 additions
and
373 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
package com.jisungin.api.talkroom; | ||
|
||
import com.jisungin.api.ApiResponse; | ||
import com.jisungin.api.oauth.Auth; | ||
import com.jisungin.api.oauth.AuthContext; | ||
import com.jisungin.api.talkroom.request.TalkRoomCreateRequest; | ||
import com.jisungin.api.talkroom.request.TalkRoomEditRequest; | ||
import com.jisungin.api.talkroom.request.TalkRoomSearchRequest; | ||
|
@@ -27,8 +29,9 @@ public class TalkRoomController { | |
|
||
// TODO. 회원 도메인이 개발되면 변경 예정 | ||
@PostMapping("/talk-rooms") | ||
public ApiResponse<TalkRoomResponse> createTalkRoom(@Valid @RequestBody TalkRoomCreateRequest request) { | ||
return ApiResponse.ok(talkRoomService.createTalkRoom(request.toServiceRequest(), "[email protected]")); | ||
public ApiResponse<TalkRoomResponse> createTalkRoom(@Valid @RequestBody TalkRoomCreateRequest request, @Auth | ||
AuthContext authContext) { | ||
return ApiResponse.ok(talkRoomService.createTalkRoom(request.toServiceRequest(), authContext.getUserId())); | ||
} | ||
|
||
@GetMapping("/talk-rooms") | ||
|
@@ -37,8 +40,9 @@ public ApiResponse<PageResponse<TalkRoomQueryResponse>> getTalkRooms(@ModelAttri | |
} | ||
|
||
@PatchMapping("/talk-rooms") | ||
public ApiResponse<TalkRoomResponse> editTalkRoom(@Valid @RequestBody TalkRoomEditRequest request) { | ||
return ApiResponse.ok(talkRoomService.editTalkRoom(request.toServiceRequest(), "[email protected]")); | ||
public ApiResponse<TalkRoomResponse> editTalkRoom(@Valid @RequestBody TalkRoomEditRequest request, | ||
@Auth AuthContext authContext) { | ||
return ApiResponse.ok(talkRoomService.editTalkRoom(request.toServiceRequest(), authContext.getUserId())); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.jisungin; | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import com.jisungin.api.comment.CommentController; | ||
import com.jisungin.api.oauth.AuthContext; | ||
import com.jisungin.api.talkroom.TalkRoomController; | ||
import com.jisungin.application.comment.CommentService; | ||
import com.jisungin.application.talkroom.TalkRoomService; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; | ||
import org.springframework.boot.test.mock.mockito.MockBean; | ||
import org.springframework.test.web.servlet.MockMvc; | ||
|
||
@WebMvcTest(controllers = { | ||
TalkRoomController.class, | ||
CommentController.class | ||
}) | ||
public abstract class ControllerTestSupport { | ||
|
||
@Autowired | ||
protected MockMvc mockMvc; | ||
|
||
@Autowired | ||
protected ObjectMapper objectMapper; | ||
|
||
@MockBean | ||
protected TalkRoomService talkRoomService; | ||
|
||
@MockBean | ||
protected CommentService commentService; | ||
|
||
@MockBean | ||
protected AuthContext authContext; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.jisungin; | ||
|
||
import org.springframework.boot.test.context.SpringBootTest; | ||
|
||
@SpringBootTest | ||
public abstract class ServiceTestSupport { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.