[threeten-dev] Please help to review new test code for java.time.calendars.MinguoChronology
Patrick Zhang
patrick.zhang at oracle.com
Tue Jan 29 23:12:04 PST 2013
Hi Team,
Please help to review below new added test case:
http://cr.openjdk.java.net/~pzhang/JSR310/java/time/calendars/MinguoChronology/
<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/MinguoChronology/TestMinguoChronology.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_ROC, a) = a
prolepticYear(ERA_BEFORE_ROC, a) = 1-a
prolepticYear(ERA_ROC, a) = "ISO prolepticYear" - 1911
And we can confirm isLeapYear(prolepticYear) should return same value
with Year.of(prolepticYear + 1911).isLeap() safely.
Above logic has been verified in test_prolepticYear().
3. It looks there is one minor typo in javadoc of MinguoChronology:
" Dates are aligned such that |0001-01-01 (Minguo)| is |1911-01-01
(ISO)|. "
Actually it should be 1912-01-01(ISO), all existing test, and my
new added test, obey it. It is only one error in javadoc.
Regards
Patrick
More information about the threeten-dev
mailing list