-
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
✅ Refactor: UserServiceTest Mock으로 리팩토링 (#26) #27
Merged
Conversation
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
Contributor
win-luck
commented
Oct 14, 2023
•
edited
Loading
edited
- User 객체 image 속성 주요 메서드에 누락된 버그 수정 (FoodServiceTest에 수정사항 반영)
- UserServiceTest Mock 객체 도입
- UserService 검색결과에서 자신 배제하는 보완 로직 추가
- 원활한 테스트코드를 위해 User에 setId() 추가
win-luck
changed the title
Feature/26 refactor userservicetest
✅ Refactor: UserServiceTest Mock으로 리팩토링 (#26)
Oct 14, 2023
synoti21
reviewed
Oct 15, 2023
@@ -53,7 +53,7 @@ public void setUp() { | |||
void testSaveAndGetFood() { // 음식 정보 저장 및 해당 날짜 음식 리스트 불러오기 | |||
// given | |||
BaseNutrition testBaseNutrition = BaseNutrition.createNutrition(1,1,1,1); | |||
Long userId = userService.saveUser(CreateUserDto.of("testUser", "testPassword", 1,180, 80,18)); | |||
Long userId = userService.saveUser(CreateUserDto.of("testUser", "testImage","testPassword", 1,180, 80,18)); |
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.
FoodService 테스트 쪽도 수정해주셔서 감사합니다~
synoti21
reviewed
Oct 15, 2023
|
||
// when | ||
ResponseUserDto responseUserDto = userService.getUserInfo(userId); | ||
given(userRepository.existsByName("test")).willReturn(false); // 유저가 존재하지 않음 |
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.
stubbing을 사용하셨군요! 참고해서 FoodServiceTest도 mocking으로 리팩토링 하겠습니다!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.