[test-improver] Add missing tests for DateUtils.isOverdue/isWithinRange/daysBetween and StringUtils.padRight#44
Draft
github-actions[bot] wants to merge 1 commit into
Conversation
Add tests for previously untested DateUtils methods: - isOverdue (past, future, null, invalid date string) - isWithinRange (middle, before-start, after-end) - daysBetween (exact week, same instant) Add padRight tests to StringUtils: - Happy paths (shorter, equal, null input) - Document known NegativeArraySizeException bug (Issue #7) via assertThrows so the bug is not silently ignored Pre-existing failures unrelated to these changes: - DateUtilsTest.testGetQuarter: off-by-one bug (Issue #6) - TaskServiceTest.testGetTaskStatistics: division by zero (Issue #3) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This was referenced Jul 3, 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
DateUtilshad three methods (isOverdue,isWithinRange,daysBetween) with zero test coverage, andStringUtils.padRighthad no tests at all despite a known crash bug. These methods are used in real business logic (overdue detection, task scheduling, reporting). Adding tests here prevents silent regressions when the code is eventually fixed or refactored.Approach
DateUtils.isOverdue— added 4 tests covering: past date (→ true), far future (→ false),nullinput (→ false, by design), and unparseable string (→ false, documents silent-failure behaviour).DateUtils.isWithinRange— added 3 tests: middle-of-range, before-start, after-end.DateUtils.daysBetween— added 2 tests: exact 7-day span, same instant (→ 0).StringUtils.padRight— added 4 tests: string shorter than width (happy path), string equal to width,nullinput, and aassertThrows(NegativeArraySizeException.class, ...)test that documents and pins the known crash bug (Issue 🟠 [BUG] StringUtils.padRight() throws StringIndexOutOfBoundsException #7). When the bug is fixed, that last assertion should be replaced with the correct expected output.No production code was changed. No new dependencies added.
Coverage Impact
StringUtilsTestDateUtilsTestNo coverage tooling is wired into CI yet (Issue #26 tracks adding JaCoCo). Line-count numbers above are approximations.
Trade-offs
testPadRight_stringLongerThanWidth_throwsBugtest intentionally documents a bug rather than correct behaviour — it will need updating when Issue 🟠 [BUG] StringUtils.padRight() throws StringIndexOutOfBoundsException #7 is resolved.addBusinessDayswas left untested: the implementation skips Friday+Saturday instead of Saturday+Sunday, so any meaningful test would immediately fail. A separate issue should drive that fix.Test Status
Pre-existing failures (not caused by this PR):
DateUtilsTest.testGetQuarter— off-by-one bug tracked in Issue 🔴 [BUG] getQuarter() returns 0-3 instead of 1-4 (off-by-one bug) #6TaskServiceTest.testGetTaskStatistics— division by zero tracked in Issue 🔴 [BUG] ArithmeticException: Division by zero on empty project dashboard #3All new tests pass:
Reproducibility
Add this agentic workflows to your repo
To install this agentic workflow, run