fix(calendar): PSCalendarMonthModel.getEvents returns null per documented contract - #198
Merged
natechadwick-intsof merged 1 commit intoSep 8, 2026
Conversation
…nted contract The JavaDoc on `getEvents(int)` states the method returns null when no events have been set or no events occur on the specified day. In practice the second case was broken: when `setEvents(...)` was called with a non-empty list and the requested day had no events, the method returned an empty collection instead of null. This caused `PSCalendarMonthModelTest.testEmptyEvents` to fail with: java.lang.AssertionError: expected null, but was:<[]> Normalize the return value in `getEvents` so an empty result becomes null, and correct the JavaDoc (the original text read "or events occur on the specified day", which is nonsensical; the intended clause is "or no events occur on the specified day"). Closes #197 > Co-Authored by MiniMax Code 1.0 using MiniMax-M3 with agent mavis.
natechadwick-intsof
deleted the
bugfix/197-fix-calendar-getevents-returns-null
branch
September 8, 2026 13:49
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.
Summary
PSCalendarMonthModel.getEvents(int)did not honor its documented contract: whensetEvents(...)was called with a non-empty list and the requested day had no events, the method returned an empty collection instead ofnull. This causedPSCalendarMonthModelTest.testEmptyEventsto fail withexpected null, but was:<[]>.The fix normalizes the return value in
getEventsitself (so an empty result becomesnull) and corrects the JavaDoc, which had a typo where the "no" was missing before "events occur on the specified day".Root cause
The JavaDoc reads:
The second clause is nonsensical as a null condition. The intended meaning (corroborated by the
@IgnoredtestEventstest which hasassertNull(m_info.getEvents(1))aftersetEvents(events)) is:Changes
modules/extensions-sfp/src/main/java/com/percussion/fastforward/calendar/PSCalendarMonthModel.javagetEvents(int): whenm_eventsByDayis non-null, also returnnullif the per-day collection is empty.Testing
Result:
Tests run: 9, Failures: 0, Errors: 0, Skipped: 1(the skipped test is the pre-existing@IgnoredtestEvents, which has separate issues unrelated to this fix).Linked issue
Closes #197