-
Notifications
You must be signed in to change notification settings - Fork 3
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
update: CallingServiceTest.kt 수정 #108
Conversation
📝 테스트 커버리지 리포트입니다
|
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.
수고하셨습니다~!
val taxiDrivers = taxiDriverRepository.findByStatus(status = TaxiDriverStatus.WAITING) | ||
return taxiDrivers | ||
if (taxiDrivers.isEmpty()) { throw java.lang.RuntimeException(ExceptionMessage.NO_SUCH_VALUE_EXISTS.name) } | ||
val taxiDriver = taxiDrivers.random() |
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.
taxiDrivers.randon() 은 추가적으로 구현하신 확장 함수 일까요?
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.
리스트에서 랜덤으로 하나 가져오는 내장함수가 있어서 사용했습니다.
@Configuration | ||
@EnableRetry | ||
class RetryConfig { | ||
} |
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.
Retry를 사용 하려면 @EnableRetry를 등록해줘야 하는군요 :)
val taxiDrivers = taxiDriverRepository.findByStatus(status = TaxiDriverStatus.WAITING) | ||
return taxiDrivers | ||
if (taxiDrivers.isEmpty()) { throw java.lang.RuntimeException(ExceptionMessage.NO_SUCH_VALUE_EXISTS.name) } |
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.
아무래도 정상 롤백을 위해 대부분의 구간의 Exception을 RuntimeException으로 변경해야 할 듯 합니다 하하.....
나이스에요 👍
@@ -195,8 +197,8 @@ class CallingServiceTest( | |||
) | |||
|
|||
// when, then | |||
assertThrows<IllegalArgumentException> { | |||
callingService.assignTaxiDriver(trip) | |||
assertThrows<RuntimeException> { |
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.
💯 테스트코드를 잘 작성하셨네요.
- 택시드라이버가 존재하지만 waiting이 없을 때
- 택시드라이버가 존재하면서 waiting이 존재하지만 일부러 오류를 내서 오류 테스트
두 가지 테스트를 더 추가하면 로직상 파악하기가 더 좋을거같아요 :)
# Conflicts: # src/main/kotlin/com/hh2/katj/trip/service/CallingService.kt # src/test/kotlin/com/hh2/katj/trip/service/CallingServiceTest.kt
해결하려는 문제가 무엇인가요?
어떻게 해결했나요?
Attachment