test : user/file/content/subscribe/submission/activity domain 테스트 코드 작성#67
test : user/file/content/subscribe/submission/activity domain 테스트 코드 작성#67gurwls0122 wants to merge 14 commits intomainfrom
Conversation
minnim1010
left a comment
There was a problem hiding this comment.
고생하셨습니다!!! 테스트 코드 공부하시면서 작성하시느라 힘드셨을 것 같네요. 추가해야 할 케이스는 딱히 없는 것 같습니다. 말씀하신대로 eventPublisher, FormRepositoryImpl, Result 테스트는 다음 회의 안건에 추가하겠습니다. 피드백 확인 부탁드려용!!!
| @@ -36,6 +32,6 @@ public class FileController { | |||
| @GetMapping("/upload/{fileName}") | |||
| @ResponseStatus(HttpStatus.OK) | |||
| FileResponseDto createPresignedUrl(@PathVariable String fileName, @AuthenticationPrincipal LoginUserDto loginUser) { | |||
There was a problem hiding this comment.
사용하지 않는 파라미터는 삭제 부탁드립니다!
|
|
||
| if (user.getNickname().equals(nickname) || userRepository.existsByNickname(nickname)) { | ||
| private void verifyNickname(String nickname) { | ||
| userValidateService.validUserNickname(nickname); |
There was a problem hiding this comment.
내부에서 닉네임 길이 유효성 검사만 하고 있으니 validUserNicknameLength()로 구체화하면 어떨까요? 메서드명만 봤을 때 verifyNickname()과 무엇이 다른지 구분이 어렵습니다.
| } | ||
|
|
||
| @Test | ||
| void 사이트에_처음_방문하지_않은_사용자는_회원가입_시_예외가_발생한다() { |
There was a problem hiding this comment.
사이트에 처음 방문하지 않은 사용자 -> 이미 회원가입한 사용자가 더 자세한 설명이라고 생각됩니다!
| } | ||
|
|
||
| @Nested | ||
| class 사용자_인증 { |
There was a problem hiding this comment.
getUserById() 테스트를 작성한 것 같은데 사용자 정보 조회가 아닌지요? 인증이라고 작성하신 이유가 궁금합니다!
| } | ||
|
|
||
| @Test | ||
| void 입력받은_사용자_ID와_세션내_ID가_다를시_예외가_발생한다() { |
There was a problem hiding this comment.
탈퇴하려는 사용자 id와 로그인한 사용자 id가 다를 시는 어떨까요? 구현보다는 비즈니스적인 용어를 사용하는 것이 좋다고 생각되어서요!
| } | ||
|
|
||
| @Nested | ||
| class 설문_참여 { |
There was a problem hiding this comment.
예외 발생할 경우가 많네요.. 고생하셨습니다 bbbb
| } | ||
|
|
||
| public SubmissionResponseDto getSubmission(long formId, LoginUserDto loginUser) { | ||
| public SubmissionResponseDto getTempSubmission(long formId, LoginUserDto loginUser) { |
There was a problem hiding this comment.
null을 반환할 수 있다면 Optional로 감싸면 어떨까요? nullable한 값을 반환할 수 있다는 걸 명시할 수 있으니 좋을 것 같습니다.
| @Nested | ||
| class 임시_참여_응답_수정 { | ||
| @Test | ||
| void 사용자는_임시_응답_설문에_대한_응답을_작성할_수_있다() { |
There was a problem hiding this comment.
사용자는_임시_응답을_수정할_수_있다...가 맞겠죠?
PR Desciption
PR Log
발생했던 문제 혹은 어려웠던 점
영속성 컨텍스트 유지 및 최신화가 어려웠습니다.
새롭게 배우거나 느낀 점
테스트 코드 짜는 방법. 어떤 코드가 나쁜 테스트 코드인가에 대해서 배웠습니다.
고민 사항