2929
3030class DateUtilsFragmentTest extends AbstractLangTest {
3131
32+ private static final Date MAX_DATE = new Date (Long .MAX_VALUE );
3233 private static final int months = 7 ; // second final prime before 12
3334 private static final int days = 23 ; // second final prime before 31 (and valid)
3435 private static final int hours = 19 ; // second final prime before 24
@@ -55,6 +56,7 @@ void testDateFragmentInLargerUnitWithCalendar() {
5556 @ Test
5657 void testDateFragmentInLargerUnitWithDate () {
5758 assertEquals (0 , DateUtils .getFragmentInDays (aDate , Calendar .DATE ));
59+ assertEquals (0 , DateUtils .getFragmentInDays (MAX_DATE , Calendar .DATE ));
5860 }
5961
6062 @ Test
@@ -65,12 +67,12 @@ void testDayOfYearFragmentInLargerUnitWithCalendar() {
6567 @ Test
6668 void testDayOfYearFragmentInLargerUnitWithDate () {
6769 assertEquals (0 , DateUtils .getFragmentInDays (aDate , Calendar .DAY_OF_YEAR ));
70+ assertEquals (0 , DateUtils .getFragmentInDays (MAX_DATE , Calendar .DAY_OF_YEAR ));
6871 }
6972
7073 @ Test
7174 void testDaysOfMonthWithCalendar () {
72- final long testResult = DateUtils .getFragmentInDays (aCalendar , Calendar .MONTH );
73- assertEquals (days , testResult );
75+ assertEquals (days , DateUtils .getFragmentInDays (aCalendar , Calendar .MONTH ));
7476 }
7577
7678 @ Test
@@ -105,6 +107,8 @@ void testHourOfDayFragmentInLargerUnitWithCalendar() {
105107 void testHourOfDayFragmentInLargerUnitWithDate () {
106108 assertEquals (0 , DateUtils .getFragmentInHours (aDate , Calendar .HOUR_OF_DAY ));
107109 assertEquals (0 , DateUtils .getFragmentInDays (aDate , Calendar .HOUR_OF_DAY ));
110+ assertEquals (0 , DateUtils .getFragmentInHours (MAX_DATE , Calendar .HOUR_OF_DAY ));
111+ assertEquals (0 , DateUtils .getFragmentInDays (MAX_DATE , Calendar .HOUR_OF_DAY ));
108112 }
109113
110114 @ Test
0 commit comments