[threeten-dev] Please help to review new test code for java.time.calendars.ThaiBuddhistChronology

Patrick Zhang patrick.zhang at oracle.com
Tue Jan 29 23:20:46 PST 2013



Hi Team,

Please help to review below new added test case:
http://cr.openjdk.java.net/~pzhang/JSR310/java/time/calendars/ThaiBuddhistChronology/webrev/ 
<http://cr.openjdk.java.net/%7Epzhang/JSR310/java/time/calendars/HijrahChronology/test/java/time/tck/java/time/calendars/TestHijrahChronology.java.udiff.html>

test result:
http://cr.openjdk.java.net/~pzhang/JSR310/java/time/calendars/ThaiBuddhistChronology/TestThaiBuddhistChronology.jtr 
<http://cr.openjdk.java.net/%7Epzhang/JSR310/java/time/calendars/HijrahChronology/TestHijrahChronology.jtr>

Description:
The new added test cases are used for prolepticYear(), datYearDay() and 
isLeapYear().
1. As positive test case, some leapYear/02/29 are verified with 
according ISO date. And we use both dateYearDay(year, doy) and date(era, 
year, month, dom) to construct same ISO date to confirm it works well.
As negative test case, some non-leapYear/02/29 are added in "badDates" 
data provider and it should throw DateTimeException.

2. According to description of javadoc, we can confirm below formula 
should work:
     prolepticYear(ERA_BE, a) = a
     prolepticYear(ERA_BEFORE_BE, a) = 1-a
     prolepticYear(ERA_BE, a) = "ISO  prolepticYear" + 543

And we can confirm isLeapYear(prolepticYear) should return same value 
with Year.of(prolepticYear - 543).isLeap() safely.

Above logic has been verified in test_prolepticYear().

Regards
Patrick




More information about the threeten-dev mailing list