Add tests for libcore.util.ZoneInfo, document and fix issues
The investigation of bug 26022884 revealed some issues with
ZoneInfo, in terms of the code structure, the documentation and
the tests (there weren't any). This change fixes those issues
in preparation for additional changes to address the problems
with GregorianCalendar.
The tests were run on a pre-OpenJDK version of AOSP and the
following tests failed - as expected:
testMakeTimeZone_HasPastDST_NoFutureDST_PositiveTransitions
This failed because System.currentTimeMillis() / 1000 does
not handle rounding properly when current time is positive.
testMakeTimeZone_LotsOfOffsets
It failed with an index out of bounds exception rather than an
explicit exception.
testMakeTimeZone_NegativeTransition
This failed because getOffset(long) and inDaylightTime(Date)
did not handle rounding properly for negative times.
testMakeTimeZone_NoOffsets
The test failed with an ArrayIndexOutOfBoundsException.
testMakeTimeZone_OneDstTransition
The test failed because the constructor did not fail. However,
the code makes no sense if there are no non-DST transitions
and the existing data doesn't require it.
testMakeTimeZone_TooManyOffsets
The test failed because the constructor did not fail. However,
the code makes no sense if there are more than 256 offsets
and the existing data doesn't require it.
Bug: 26734751
Change-Id: I5b2a64c99e0fd98aec4fea430397110c1102fd2e
4 files changed