-
Notifications
You must be signed in to change notification settings - Fork 0
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
[FEAT] 4주차 테스트 코드 10개 작성 #1
base: main
Are you sure you want to change the base?
Conversation
mikekks
commented
Mar 21, 2024
•
edited
Loading
edited
- 사알짝 급하게 짠 느낌이 없지 않아 있는데 다음주엔 퀄 좀 높여 보겠습니다..ㅎㅎ..
- Enum 쪽 로직을 잘못 짰네여..! 이 부분은 수정하겠습니다..!
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.
역시 프린스송,,, 배워갑니다 커버리지 높은 그대의 코드 논메에서 잘 보고 쓸게요 ㅋ.ㅋ
runtimeOnly 'com.h2database:h2' | ||
|
||
} | ||
|
||
tasks.named('test') { | ||
useJUnitPlatform() | ||
finalizedBy jacocoTestCoverageVerification | ||
|
||
jacoco { |
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 AgeEnum getAgeEnum(int age) { | ||
return Arrays.stream(AgeEnum.values()) | ||
.filter(ageEnum -> ageEnum.minAge <= age && ageEnum.maxAge >= age) | ||
.findAny() | ||
.orElseThrow(() -> new CustomException(INVALID_AGE_ENUM, INVALID_AGE_ENUM.getMessage())); | ||
} | ||
|
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.
오 이렇게 수정하셨군요!! 근데 서비스의 이해를 높여드리자면 TEENAGER의 minAge는 0살이면 좋을 것 같습니다! 10대 이하일 경우 에러를 반환하는게 아니라 그냥 10대의 결과를 반환하는게 저희 솝커톤의 서비스 흐름이었거든요!
doReturn(resultResponseDTO).when(resultService).saveResult(any()); | ||
|
||
// when | ||
final ResultActions resultActions = mockMvc.perform( |
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.
테스트에서도 변하지 않는 것에 대해 final을 붙이는 습관 좋은 것 같습니다~