You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
test: fill in unit test coverage for DataExportParams validation predicates (#24469)
* test: fill in unit test coverage for DataExportParams validation predicates
Follow-up from DHIS2-21821 / PR #24465. Before that fix, DataExportParams
had no direct unit tests for any of its validation predicates, which is
likely how the lastUpdated/lastUpdatedDuration branches were silently
dropped from hasPeriodFilters() during the 2.43 SQL-export rewrite
(#22406) without any test catching it. Coverage existed only indirectly
via slow integration tests asserting the resulting ErrorCode.
Adds direct unit tests for every branch of hasDataElementFilters,
hasOrgUnitFilters, isExactOrgUnitsFilter, isPeriodOverSpecified,
isDateRangeOutOfBounds, isLimitOutOfBounds, isOrgUnitGroupsOverSpecified,
plus the previously-untested true-branches of hasPeriodFilters itself
(periods, periodTypes, startDate+endDate, includedDate).
Verified isPeriodOverSpecified and isDateRangeOutOfBounds tests aren't
vacuous by temporarily dropping a conjunct from each in production code,
confirming the corresponding _OnlyFalse test caught it, then restoring
(net diff to DataExportParams.java is zero).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* test: cover startDate == endDate boundary for isDateRangeOutOfBounds
Date.after() is strict (>), so a single-instant/single-day range
(startDate == endDate) is currently treated as valid, not out of
bounds. This boundary — the exact line between valid and invalid —
wasn't covered by the earlier StartBeforeEndFalse/StartAfterEndTrue
tests.
Verified via mutation testing: swapped the strict startDate.after(endDate)
check for an inclusive !startDate.before(endDate) in DataExportParams,
confirmed only the new test failed (all 33 others stayed green), then
restored (net diff to DataExportParams.java is zero).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
0 commit comments