Skip to content
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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

mikekks
Copy link
Contributor

@mikekks mikekks commented Mar 21, 2024

  • 사알짝 급하게 짠 느낌이 없지 않아 있는데 다음주엔 퀄 좀 높여 보겠습니다..ㅎㅎ..
  • Enum 쪽 로직을 잘못 짰네여..! 이 부분은 수정하겠습니다..!

@mikekks mikekks self-assigned this Mar 21, 2024
Copy link
Member

@sung-silver sung-silver left a 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 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

굿!

Comment on lines +38 to +44
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()));
}

Copy link
Member

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(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

테스트에서도 변하지 않는 것에 대해 final을 붙이는 습관 좋은 것 같습니다~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants