Conversation
검증을 추가해서 NUll로 들어온다면 NPE를 발생시키게 수정했습니다.
caniro
approved these changes
Jun 1, 2025
Contributor
caniro
left a comment
There was a problem hiding this comment.
와 리팩토링이랑 테스트 많이 하셨네요 ㅋㅋ 고생하셨습니다 ㅠㅠ
| if (yesterdayLastTrade == null) { | ||
| log.debug("전일 거래 데이터가 없습니다: {}", ticker); | ||
| return new PrevRateDto(ticker, 0.0, currentTrade.getPrice(), 0.0, LocalDateTime.now()); | ||
| return new PrevRateDto(ticker, 0.0, currentTrade.getPrice(), 0.0, currentTime); |
Contributor
There was a problem hiding this comment.
시간 주입받는 식으로 변경하셨네요 ㅋㅋ 실행력 굿,,
| private void setField(Object target, String fieldName, Object value) throws Exception { | ||
| java.lang.reflect.Field field = Trade.class.getDeclaredField(fieldName); | ||
| field.setAccessible(true); | ||
| field.set(target, value); |
Contributor
There was a problem hiding this comment.
혹시 리플렉션 쓰신 이유가 있으신가요??
이렇게 필드를 설정하면 나중에 필드명 변경하거나 했을 때, 미리 찾을 수 없을 것 같아서요
Contributor
Author
There was a problem hiding this comment.
private 필드로 생성을 해서 테스트에서 접근할려면 리플렉션으로 접근하는게 좋을 것 같아서 구현했는데
찾아보니 안티패턴이 될 수도 있기때문에 지양한다고 하네요ㅠㅠ
다시 수정하고 올리겠습니다!
리뷰 감사합니다
Contributor
Author
There was a problem hiding this comment.
리플렉션 코드 삭제하고 기본 생성자를 통해 생성했습니다
Junh-b
reviewed
Jun 2, 2025
Contributor
Junh-b
left a comment
There was a problem hiding this comment.
전반적으로 validation logic이 꼼꼼하게 추가되었네요.
많은 양의 테스트 작성하신 것도 잘 보았습니다.
Contributor
|
아까 남길려고 했는데 저도 리플렉션 썻는데 코멘트 보고 후다닥 바꿨습니다. |
This file contains hidden or 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
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.

✨ 작업내용
🐞 이슈사항