Transfer 엔티티 totalAmount 불변식 음수만 안되게 수정#234
Conversation
There was a problem hiding this comment.
Code Review
This pull request modifies the validation logic for totalAmount in Transfer.java to allow zero values, changing the condition from <= 0 to < 0 and updating the exception message. The reviewer pointed out that the new exception message is grammatically awkward and suggested using "totalAmount must be non-negative" instead, while also noting that existing tests verifying zero-value exceptions will need to be updated.
| if (value.compareTo(BigDecimal.ZERO) < 0) { | ||
| throw new IllegalArgumentException("totalAmount must be greater than minus"); |
There was a problem hiding this comment.
예외 메시지인 "totalAmount must be greater than minus"는 영문법상 어색하며 의미가 모호합니다. 음수를 허용하지 않는다는 의도를 명확히 하기 위해 "totalAmount must be non-negative" 또는 "totalAmount must be greater than or equal to zero"로 변경하는 것이 좋습니다.
또한, 이 변경으로 인해 기존 TransferTest.java의 changeTotalAmount_zeroOrNegative_throws 테스트(금액이 0일 때 예외 발생을 검증하는 테스트)가 실패하게 됩니다. 테스트 코드도 이번 변경 사항에 맞춰 함께 수정해 주세요.
| if (value.compareTo(BigDecimal.ZERO) < 0) { | |
| throw new IllegalArgumentException("totalAmount must be greater than minus"); | |
| if (value.compareTo(BigDecimal.ZERO) < 0) { | |
| throw new IllegalArgumentException("totalAmount must be non-negative"); | |
| } |
No description provided.