[test-improver] Add tests documenting addBusinessDays weekend-skipping bug#49
Draft
github-actions[bot] wants to merge 1 commit into
Draft
[test-improver] Add tests documenting addBusinessDays weekend-skipping bug#49github-actions[bot] wants to merge 1 commit into
github-actions[bot] wants to merge 1 commit into
Conversation
DateUtils.addBusinessDays skips day-of-week 6 (FRIDAY) and 7 (SATURDAY)
instead of 7 (SATURDAY) and 1 (SUNDAY). This means:
• Friday is wrongly treated as a non-business day
• Sunday is wrongly treated as a business day
Adds 7 tests:
• 3 tests for cases where buggy and correct implementations agree
(Mon+0, Mon+1, Mon+3, Mon+5)
• 3 "_BUG" tests that pin the current wrong output so the bug cannot
regress silently: Thu+1→SUN (correct=FRI), Fri+1→SUN (correct=MON),
Mon+4→SUN (correct=FRI)
When the bug is fixed the _BUG assertions should be updated to the
correct day-of-week values noted in the test comments.
Pre-existing failures unchanged: DateUtilsTest.testGetQuarter (Issue #6),
TaskServiceTest.testGetTaskStatistics (Issue #3).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This was referenced Jul 4, 2026
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.
🤖 Test Improver — automated AI assistant focused on improving tests.
Goal & Rationale
DateUtils.addBusinessDayshas a well-known but completely untested bug: it skips day-of-week 6 (FRIDAY) and 7 (SATURDAY) instead of 7 (SATURDAY) and 1 (SUNDAY). This means:A task with a Monday deadline, created on Thursday, would schedule to Sunday — a day outside business hours. Without tests, this bug is invisible in CI and will likely regress after any refactoring.
Approach
7 tests added to
DateUtilsTest, covering three categories:Correct-behaviour tests (pass with both buggy and fixed code)
testAddBusinessDays_zeroDays_returnsSameDaytestAddBusinessDays_mondayPlusOne_returnsTuesdaytestAddBusinessDays_mondayPlusThree_returnsThursdaytestAddBusinessDays_mondayPlusFive_returnsMondayBug-pin tests (pass now; need updating when bug is fixed)
testAddBusinessDays_thursdayPlusOne_BUGtestAddBusinessDays_fridayPlusOne_BUGtestAddBusinessDays_mondayPlusFour_BUGBug-pin tests assert the current (wrong) value so the tests pass today and protect against silent regression. When the bug is fixed the
assertEqualsin each_BUGtest must be updated to the "Correct result" value shown above — the comment in each test specifies this.Test Status
Pre-existing failures (not caused by this PR):
DateUtilsTest.testGetQuarter— off-by-one bug (Issue 🔴 [BUG] getQuarter() returns 0-3 instead of 1-4 (off-by-one bug) #6)TaskServiceTest.testGetTaskStatistics— division by zero (Issue 🔴 [BUG] ArithmeticException: Division by zero on empty project dashboard #3)All 7 new tests pass.
Coverage Impact
No coverage tooling in CI yet (Issue #26 / Issue #47 tracks adding JaCoCo). The
addBusinessDaysmethod had zero test coverage before; it now has 7 tests exercising multiple paths through the method.Trade-offs
StringUtils.padRightin PR [test-improver] Add missing tests for DateUtils.isOverdue/isWithinRange/daysBetween and StringUtils.padRight #44. The comment in each test explains the correct behaviour and what must change on fix.Reproducibility
Add this agentic workflows to your repo
To install this agentic workflow, run