Skip to content

Transfer 엔티티 totalAmount 불변식 음수만 안되게 수정#234

Merged
chungjeongsu merged 2 commits into
developfrom
fix/transfer-entity-totalAmount-rule
May 26, 2026
Merged

Transfer 엔티티 totalAmount 불변식 음수만 안되게 수정#234
chungjeongsu merged 2 commits into
developfrom
fix/transfer-entity-totalAmount-rule

Conversation

@chungjeongsu

Copy link
Copy Markdown
Contributor

No description provided.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Comment on lines +131 to +132
if (value.compareTo(BigDecimal.ZERO) < 0) {
throw new IllegalArgumentException("totalAmount must be greater than minus");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

예외 메시지인 "totalAmount must be greater than minus"는 영문법상 어색하며 의미가 모호합니다. 음수를 허용하지 않는다는 의도를 명확히 하기 위해 "totalAmount must be non-negative" 또는 "totalAmount must be greater than or equal to zero"로 변경하는 것이 좋습니다.

또한, 이 변경으로 인해 기존 TransferTest.javachangeTotalAmount_zeroOrNegative_throws 테스트(금액이 0일 때 예외 발생을 검증하는 테스트)가 실패하게 됩니다. 테스트 코드도 이번 변경 사항에 맞춰 함께 수정해 주세요.

Suggested change
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");
}

@chungjeongsu chungjeongsu merged commit d348df8 into develop May 26, 2026
1 check passed
@chungjeongsu chungjeongsu deleted the fix/transfer-entity-totalAmount-rule branch May 26, 2026 09:47
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.

1 participant