Problem
com.percussion.fastforward.calendar.PSCalendarMonthModel.getEvents(int day) does not honor its documented contract.
The JavaDoc states the method will return null "if no events have been set or no events occur on the specified day". In practice, the second case is broken: when setEvents(...) has been called with a non-empty list and the requested day simply has no events, the method returns an empty collection instead of null.
This causes PSCalendarMonthModelTest.testEmptyEvents to fail:
java.lang.AssertionError: expected null, but was:<[]>
at com.percussion.fastforward.calendar.PSCalendarMonthModelTest.testEmptyEvents(PSCalendarMonthModelTest.java:252)
Fix
Normalize the return value in getEvents itself so an empty result is converted to null, and correct the JavaDoc typo (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").
Files
modules/extensions-sfp/src/main/java/com/percussion/fastforward/calendar/PSCalendarMonthModel.java
Testing
./mvn-env.sh test -Dtest=PSCalendarMonthModelTest -pl modules/extensions-sfp → 9 run, 0 failures, 1 skipped (pre-existing @Ignored testEvents).
Co-Authored by MiniMax Code 1.0 using MiniMax-M3 with agent mavis.
Problem
com.percussion.fastforward.calendar.PSCalendarMonthModel.getEvents(int day)does not honor its documented contract.The JavaDoc states the method will return
null"if no events have been set or no events occur on the specified day". In practice, the second case is broken: whensetEvents(...)has been called with a non-empty list and the requested day simply has no events, the method returns an empty collection instead ofnull.This causes
PSCalendarMonthModelTest.testEmptyEventsto fail:Fix
Normalize the return value in
getEventsitself so an empty result is converted tonull, and correct the JavaDoc typo (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").Files
modules/extensions-sfp/src/main/java/com/percussion/fastforward/calendar/PSCalendarMonthModel.javaTesting
./mvn-env.sh test -Dtest=PSCalendarMonthModelTest -pl modules/extensions-sfp→ 9 run, 0 failures, 1 skipped (pre-existing@IgnoredtestEvents).