Skip to content

[test] 급여 계산 경계값 테스트 추가#92

Merged
geunyong16 merged 3 commits into
mainfrom
test/62-급여계산로직-테스트-상세화
Feb 2, 2026

Hidden character warning

The head ref may contain hidden characters: "test/62-\uae09\uc5ec\uacc4\uc0b0\ub85c\uc9c1-\ud14c\uc2a4\ud2b8-\uc0c1\uc138\ud654"
Merged

[test] 급여 계산 경계값 테스트 추가#92
geunyong16 merged 3 commits into
mainfrom
test/62-급여계산로직-테스트-상세화

Conversation

@thdud7
Copy link
Copy Markdown
Collaborator

@thdud7 thdud7 commented Jan 26, 2026

📝 변경 사항

주요 변경 내용

  • 급여 계산 엣지 케이스 테스트 추가

상세 설명

  • 평일 8시간 경계값에서 연장수당 발생 여부 검증
  • 야간, 연장 중복 시나리오 분 단위 계산하고 총 급여까지 확인
  • 주휴수당 반올림 케이스에서 소수점 처리 결과를 데이터셋 기반으로 1원 단위로 비교
  • 주 40시간 경계값에서 연장수당 발생 여부 및 금액 검증
  • 월 경계 이월 로직 검증

✅ 체크리스트

  • PR 제목이 형식에 맞는가? (유형: 작업 요약)
  • 코드가 정상적으로 빌드되는가?
  • 새로운 기능에 대한 테스트 코드를 작성했는가?
  • 모든 테스트가 통과하는가?
  • 코드 스타일 가이드를 따랐는가?
  • 관련 문서를 업데이트했는가?

Summary by CodeRabbit

  • Tests
    • 급여 계산 정밀도 검증을 위한 데이터셋 기반 테스트 추가
    • 주간 유급휴가 및 초과근무의 경계값(분 단위) 검증 테스트 추가
    • 분 단위 시간 정밀도를 포함한 야간·초과근무 복합 시나리오 테스트 강화
    • 전월 이월금 포함·당월 마지막 주 제외 등 월간 급여 계산 흐름 검증 테스트 추가

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jan 26, 2026

Walkthrough

정밀도(1원) 검증, 경계값(분 단위 포함) 및 복합 시나리오를 검증하는 테스트들이 추가되었고, 데이터셋 기반 테스트와 해당 JSON 픽스처가 새로 도입되었습니다. 프로덕션 코드 변경은 없습니다.

Changes

응집도 / 파일(s) 변경 요약
기존 단위테스트 확장
src/test/java/com/example/paycheck/domain/allowance/entity/WeeklyAllowanceTest.java
주간 휴일수당 관련 반올림·경계 케이스 테스트 추가(고시급·분 단위 정밀도)
기존 단위테스트 확장
src/test/java/com/example/paycheck/domain/workrecord/entity/WorkRecordTest.java
분 단위 경계(8시간 vs 8시간1분), 야간+연장 복합 시나리오 등 정밀 검증 테스트 추가(일부 테스트 중복 삽입 확인)
기존 단위테스트 확장
src/test/java/com/example/paycheck/domain/salary/service/SalaryServiceSimpleTest.java
월간 이월 계산 관련 시나리오 테스트 추가(이전 달 이월 포함, 현재 마지막 주 제외 로직 검증)
새로운 데이터셋 기반 테스트
src/test/java/com/example/paycheck/domain/salary/PayrollPrecisionDatasetTest.java
JSON 리소스(/datasets/payroll_precision_cases.json) 기반의 데이터드리븐 테스트 추가: WeeklyPaidLeave 및 WorkRecord 흐름을 읽어 정밀 금액(1원) 비교; ObjectMapper·Mockito·AssertJ 사용
테스트 데이터 픽스처 추가
src/test/resources/datasets/payroll_precision_cases.json
주간 휴일수당 및 근무기록 케이스(정확한 예상 금액 포함) JSON 파일 추가

Sequence Diagram(s)

(생성 조건 미충족 — 변경은 테스트 추가/정밀 검증에 국한되어 있어 다중 컴포넌트 제어 흐름 시각화가 필요하지 않습니다.)

추정 코드 리뷰 노력

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed PR 제목이 '[test] 급여 계산 경계값 테스트 추가'로 주요 변경 사항(경계값 테스트 추가)을 명확하게 요약하고 있습니다.
Description check ✅ Passed PR 설명이 템플릿 형식을 따르고, 관련 Issue, 주요 변경 내용, 상세 설명, 체크리스트를 모두 포함하고 있습니다.
Linked Issues check ✅ Passed PR의 모든 주요 코드 변경사항이 Issue #62의 목표를 충족합니다: 경계값 테스트(8시간 vs 8시간 1분, 40시간 경계), 1원 단위 정밀도 검증 데이터셋, 야간+연장 복합 시나리오, 월 경계 이월 로직 검증.
Out of Scope Changes check ✅ Passed 모든 변경사항이 급여 계산 테스트 강화라는 명확한 범위 내에 있으며, 프로덕션 코드 변경이 없고 테스트 케이스와 테스트 데이터만 추가되어 있습니다.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In
`@src/test/java/com/example/paycheck/domain/salary/service/SalaryServiceSimpleTest.java`:
- Around line 311-313: The mock excludedCurrentLastWeek is missing stubs for
getWeeklyPaidLeaveAmount() and getOvertimeAmount(), which can lead to NPEs
because SalaryService calls these before date-filtering; update the test to stub
excludedCurrentLastWeek.getWeeklyPaidLeaveAmount() and
excludedCurrentLastWeek.getOvertimeAmount() with the same style/values used for
includedCurrent and includedPreviousLastWeek so the mock is fully consistent
with those objects and prevents null returns when SalaryService invokes those
methods.
🧹 Nitpick comments (2)
src/test/java/com/example/paycheck/domain/salary/service/SalaryServiceSimpleTest.java (2)

266-268: 테스트 메서드명을 한글로 변경하는 것을 고려해 주세요.

코딩 가이드라인에 따르면 테스트 메서드명은 한글 사용이 권장됩니다. 현재 메서드명이 다소 길고 복잡하므로, 한글로 변경하면 가독성이 향상될 수 있습니다.

예시: 급여_자동_계산_시_전월_마지막주차_이월_포함_당월_마지막주차_제외()


333-340: 주휴수당에 대한 명시적 검증 추가를 고려해 주세요.

현재 totalGrossPayovertimePay만 검증하고 있습니다. 이 테스트의 목적이 월 경계 이월 로직 검증이므로, 주휴수당(weeklyPaidLeaveAmount)도 명시적으로 검증하면 테스트 의도가 더 명확해집니다.

♻️ 제안하는 추가 검증
 // then
 assertThat(response.getTotalGrossPay()).isEqualByComparingTo(new BigDecimal("192000.00"));
 assertThat(response.getOvertimePay()).isEqualByComparingTo(new BigDecimal("22000.00"));
+// 주휴수당: 30000 (당월) + 40000 (전월 이월) = 70000
+// Note: SalaryDto.Response에 weeklyPaidLeaveAmount 필드가 있다면 검증 추가
 assertThat(response.getPaymentDueDate()).isEqualTo("2024-03-25");

@geunyong16 geunyong16 merged commit 8bad01d into main Feb 2, 2026
1 check passed
@geunyong16 geunyong16 deleted the test/62-급여계산로직-테스트-상세화 branch February 2, 2026 01:32
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.

[MAINTENANCE] 급여 계산 로직 테스트 상세화: 경계값, 복합 시나리오 및 정밀 검증 추가

2 participants