-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix/#42 test fix #52
Fix/#42 test fix #52
Conversation
โฆ๋ฐ ์์กด ๊ฐ์ฒด ๋์ด ์คํ์ผ ๋ณ๊ฒฝ
โฆGenerator๋ก ๋ณ๊ฒฝ
โฆ์์ + ์ค์ ๋ฐ์ดํฐ๋ฒ ์ด์ค ์ ๊ทผํ๋๋ก ์์ ํ ์์
โฆringboot ์ ๋ํ ์ด์ ์ฌ์ฉํจ์๋ฐ๋ฅธ ์ญ์ ๋ฐ ์์กด ๊ฐ์ฒด ๋์ด ์คํ์ผ ๋ณ๊ฒฝ
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ํ
์คํธ ์ฝ๋์ ๋ฌธ์ ์๋ค๋๊ฑธ ์ธ์ง ํ์๊ณ 2~3์ผ๊ฐ ๋ฆฌํํ ๋ง๋ง ํ์
จ๋๋ฐ ๋๋ฌด ๊ณ ์ํ์
จ์ต๋๋ค !
๋ชจ๋ ํ
์คํธ๊ฐ ์ ํต๊ณผํ๋ค์ ใ
ใ
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
๋ง์ํ์ ๋๋ก ์์ ํด์ฃผ์ จ๊ตฐ์ ! ์ปจ๋ฒค์ ์ผ๋ก ํ์ฉํ๋๋ก ํ๊ฒ ์ต๋๋ค
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
chatBlock -> Block์ผ๋ก ๋ณ๊ฒฝ๋ ๋ถ๋ถ์ธ๊ฐ์?
๋ณ๊ฒฝํด์ฃผ์
์ ๊ฐ์ฌํฉ๋๋ค ใ
ใ
ChatSummaryResponse chatSummaryResponse = chatService.getChatSummaries(memberId); | ||
Map<String, ChatSummaryResponse> response = Collections.singletonMap("response", chatSummaryResponse); | ||
return ResponseEntity.ok(response); | ||
public SuccessResponse<ChatSummaryResponse> getChatSummaries(@Login Long memberId) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(@Login Long memberId) ์ด ๋ถ๋ถ
@Login LoginMember loginMember ๋ก ๋ณ๊ฒฝ๋์ด์ผ ํ์ง ์๋์?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ํ
์คํธ ์ฝ๋๊ฐ ์ฑ๊ณตํ๋๋ก๋ง ํผ๋๋ฐฑ ํ๋ ๋ถ๋ถ์ ์ต๋ํ ์์ ํ์ง ์๊ณ ์ ํ์ต๋๋ค. (์๊ณ ์๋๋ฐ ์ผ๋จ ๋์ด์ ๐ฅฒ)
์ ๊ฐ ์์ ํ ๋ถ๋ถ๋ค์ ์ ๋ง ํ
์คํธ ๋ณ๊ฒฝ์ ํ์ํด์ ์์ ํ ๋ถ๋ถ๋ค์
๋๋ค๐โโ๏ธ
public static ChatReport of(Member reportingMember, | ||
Member reportedMember, | ||
ChatReportCategory category, | ||
String content) { | ||
ChatReport chatReport = new ChatReport(); | ||
chatReport.reportedMemberId = chatReportRequest.partnerId(); | ||
chatReport.reportingMemberId = reportingMemberId; | ||
chatReport.category = ChatReportCategory.fromString(chatReportRequest.category()) | ||
.orElseThrow(() -> new RestApiException(ChatError.INVALID_REPORT_CATEGORY)); | ||
chatReport.content = chatReportRequest.content(); | ||
chatReport.reportingMember = reportingMember; | ||
chatReport.reportedMember = reportedMember; | ||
chatReport.category = category; | ||
chatReport.content = content; | ||
return chatReport; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ํ๋์ฉ ์ง์ด ๋ฃ์ด์ ์์ฑ(?)ํ๋ ๋ฐฉ๋ฒ ๋ณด๋จ, new ํค์๋๋ก ์์ฑํ๋๊ฒ ์ข์ ๊ฒ ๊ฐ์ต๋๋ค !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
์ด๋ ์์ธ์ฒ๋ฆฌ๋ฅผ ์ด๋๋ด์์ ๊ด๋ฆฌํ๊ณ ์๋๊ฒ ๊ฐ์๋ฐ ์์ ํ์ผ์๋ ์๋ณด์ด๋ค์! ๋จธ์ง ํ ๋ณ๊ฒฝํด๋๊ฒ ์ต๋๋ค!
public static ChatRoom of(final Member me, final Member partner) { | ||
ChatRoom chatRoom = new ChatRoom(); | ||
chatRoom.member = me; | ||
chatRoom.partner = partner; | ||
return chatRoom; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
์ด ๋ถ๋ถ๋ return new ํค์๋๋ก ์์ฑํ๋ ๊ฒ์ด ์ข์๋ณด์ ๋๋ค! ์ฝ๋๋ ๋ ๊ฐ๊ฒฐํด์ง ๊ฒ ๊ฐ์ต๋๋ค
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
๋จธ์ง ํ ์ ๊ฐ ์์ ํด๋๊ฒ ์ต๋๋ค!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
์๋ฌ ์, ๋ก๊ทธ๋ก ์๋ฌ ์ฝ๋๋ฅผ ๋จ๊ธฐ๋๋ก ๋ณ๊ฒฝํด๋ฌ๋ผ๋ ํผ๋๋ฐฑ์ ์ ๊ทน ๋ฐ์ํด์ฃผ์
จ๊ตฐ์ !
๊ฐ์ฌํฉ๋๋ค ! ๐
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
์ฌ์ฉํ์ง ์๋ import๋ฌธ ์ญ์ ! ์ ๋ ์ฃผ์ ํ๊ฒ ์ต๋๋ค
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
~SuccessCode -> Success๋ก ๋ค์ด๋ฐ ๋ณ๊ฒฝํ์
จ๊ตฐ์ !
ํ์ธํ์ต๋๋ค
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MemberError ๊ฐ MemberErrorCode๊ฐ ์๋ ๊ฒ ์ฒ๋ผ ๋ค์ด๋ฐ์ด ๊ธธ์ด์ง์ง ์๋๋ก,
SuccessCode -> Success๋ก ์์ ํ์ต๋๋ค!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
๊ตณ๊ตณ~~!! ์ฑํ
๋ถ๋ถ ๋ฆฌํฉํ ๋ง ์ด์๋ ํด๊ฒฐํด์ฃผ์
จ๋ค์! ๋๋ถ์ ์ธ์ฆ์ชฝ ์ด์๋ง ์ง์คํด์ ์ ๊ฒฝ์ธ ์ ์๊ฒ ๋ค์ :) ๋๋จธ์ง๋ ๋จธ์ง ํ ์ถ๊ฐ ์์ ํด๋๊ฒ ์ต๋๋ค!
ํ
์คํธ์ชฝ์ BaseServiceTest, ์ ๋๋ ์ดํฐ ์ฐ๊ธฐ ํธํ๋๋ก ์ ๊ตฌ์ฑํด์ฃผ์ ๊ฒ ๋๋ฌด ๋ง์์ ๋ค์ด์.
๊ณ ์ํ์
จ์ต๋๋ค!! ๋ฐค์ ์์
๊น๋ช
์ค... ๊ทธ๋ ๋์ฒด
|
||
@ManyToOne | ||
@JoinColumn(name = "blocking_member_id") | ||
private Member blockingMember; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Join ๋ฃ์ด์ฃผ์ จ๊ตฐ์!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ใ
ใ
ใ
ํผ๋๋ฐฑ ๋๋ฆฐ ๋ด์ฉ์ ์ ๊ฐ ์์ ํด์ ์ฃ์กํฉ๋๋ค..
ํ
์คํธ ์ฝ๋๋ฅผ ์์ ํด์ ๋์๊ฐ๋๋ก ํด๋, ์ํฐํฐ๊ฐ ์์ ๋๋ฉด ๋ค์ ํ
์คํธ์ฝ๋๋ฅผ ์์ ์์ ํ๊ฒ๋๋ ์ํฉ์ด ๋ฒ์ด์ ธ์..
์ ๊ฐ ์ผ๋จ ์ํฐํฐ์ join. ์์
์ ์ํํ์ต๋๋ค ๐ฅฒ
} | ||
|
||
@PostMapping("/chat/block") | ||
public SuccessResponse<String> blockPartner(@Login LoginMember loginMember, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
๋ฉค๋ฒ๋ ๋ณํํด์ฃผ์ จ๋ค์! ๊ฐ์ฌํฉ๋๋ค
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
์ํ๋๊ป์ ์์ฑํ์ ๋ฆฌ๋ทฐ์์ ์ฒ๋ผ, ์์ง @Login ์์ Long memberId๋ฅผ ๋ฐ๊ณ ์๋ ์ปจํธ๋กค๋ฌ๋ ์์ต๋๋ค!
์ต์ํ์ผ๋ก ์์ ํ๊ณ ์ํด์ ํผ๋๋ฐฑ ๋ฐ์ผ์ ๋ถ๋ถ๋ค ๋ค์ ํ์ธ ๋ถํ๋๋ฆฌ๊ฒ ์ต๋๋ค ๐โโ๏ธ
@DisplayName("์ฑํ ์๋ ์ฐจ๋จ") | ||
void blockPartner() { | ||
//Given | ||
List<Member> members = dummyGenerator.generateMultiMember(2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
class ChatServiceTest extends BaseServiceTest { | ||
|
||
@Autowired ChatService chatService; | ||
@SpyBean MessageRepository messageRepository; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mockbean -> Spybean ๐
import java.util.Random; | ||
|
||
@Component | ||
public class DummyGenerator { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
์ด๊ฑฐ ๋๋ถ์ ํ ์คํธ ๊น๋ํด์ง๋๊ฒ ๋๋ฌด ์ข์์. ๊ฐ ๋๋ฉ์ธ ํ ์คํธ๋ง๋ค ์ฝ๊ฒ ๊ด๋ฆฌํ ์ ์๊ฒ ์ ํด์ฃผ์ จ๋ค์ LGTM!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Member ๊ฐ์ ๊ฒฝ์ฐ๋ ๋ชจ๋ ๋๋ฉ์ธ์ ์ฐ๊ฒฐ๋์ด ์์ด์ ์ฐจ๋ผ๋ฆฌ ๋ง๋ค์ด ๋๋๊ฒ ์ข๊ฒ ๋ค ํ๋จํ์ด์!
์์๋ด์ฃผ์
์ ๊ฐ์ฌํฉ๋๋ค ๐
์ผ๋จ doc ์ ์ธํ๊ณ ํ
์คํธ๊ฐ ๋์๊ฐ๋ฉด์.. ํผ๋๋ฐฑ ๋๋ฆฐ ๋ถ๋ถ๋ค์ ์ ๊ฐ ์์ ํ์ง ์๊ฒ ํ๊ธฐ ์ํด ์ต๋ํ ๋
ธ๋ ฅํ์ง๋ง MockBean์ ์ด์ ์ฌ์ฉํ์ง ์๊ธฐ๋ก ์ปจ๋ฒค์
์ผ๋ก ์ ํ๊ณ , |
๐คจ Motivation
๐ Key Changes
๐ To Reviewers
doc์ ์ ์ธํ ํ ์คํธ ์ฝ๋๋ ๋ชจ๋ ์ด๋ ธ์ต๋๋ค.
๊ทธ๋ฌ๋ doc์ ์ํด ์์ฑ๋ Controller ํ ์คํธ๋ค์ ํด๊ฒฐํ์ง ๋ชปํ์ฌ ์ฃผ์ ์ฒ๋ฆฌํ์์ต๋๋ค.
doc ์์ ์ฌ์ฉ๋๋ TokenProvider ๋ฅผ Mockbean์ผ๋ก ๋๋ ๋ฌธ์ ์ธ์ง,
ํน์ Controller์์ ์ฐ๊ด๋ ์์กด์ฑ ๊ฐ์ ์ถฉ๋์ธ์ง ์ ํํ ๋ฌธ์ ๋ฅผ ํ์ธํ์ง ๋ชปํ๊ณ ์๋ ์ํฉ์ ๋๋ค.
(์ด๋ ํ ํ ์คํธ๊ฐ ์ฑ๊ณตํ๋ฉด ์ด๋ ํ ํ ์คํธ๋ ์คํจํ๊ณ ์์ต๋๋ค.)
๊ธฐ๋ฅ ๊ตฌํ์ ๋ค ํ๊ณ ์ถํ์ ํด๊ฒฐํ ์ ์๋๋ก ์กฐ์นํ๊ฒ ์ต๋๋ค.
ํ ์คํธ ์ฝ๋ ์์์ ์ํด ์ค์ ๋น์ ์ฃผ์ ๋ฐ์ ๋์ํ๋๋ก ์์ ํ์ต๋๋ค. ์ด์ ๋ฐ๋ผ ์ด์ Pr ์์ ํผ๋๋ฐฑ์ ์๋ ๋ด์ฉ ๋ช๊ฐ์ง๋ฅผ ์์ ํ๊ฒ ๋์์ต๋๋ค.
์ดํ์ ์์ ์ ๊ณ์ํด์ ํด๋น ๋ธ๋์น ๋ฐ๊ณ ์์ ํ์๋ฉด ๋ฉ๋๋ค!
์๋์น ์๊ฒ ํผ๋๋ฐฑ์ ๋ํ ์ฝ๋๋ฅผ ์์ ํ๊ฒ๋๊ณ , ๋ง์ ์๊ฐ์ ๋์ ์ฃ์กํฉ๋๋ค ๐ฅฒ๐โโ๏ธ