RFR: 8376698: Add Spliterator tests for TreeMap sub-maps
Oli Gillespie
ogillespie at openjdk.org
Fri Jan 30 09:16:44 UTC 2026
On Thu, 29 Jan 2026 22:35:58 GMT, Chen Liang <liach at openjdk.org> wrote:
>> I'd rather see it tested explicitly; its hard to identify exactly which test expects and catches the NPE.
>
> The modification to that test adds new entries to a data provider. The NPE is checked by the preexisting testNullPointerException which tests all speliterators in the data set. I don't think an additional explicit unit test provides much value over the existing "cartesian" setup.
Thanks, indeed [testNullPointerException](https://github.com/openjdk/jdk/blob/master/test/jdk/java/util/Spliterator/SpliteratorTraversingAndSplittingTest.java#L668) runs on all of the input spliterators and sizes, and empty is [explicitly](https://github.com/openjdk/jdk/blob/master/test/jdk/java/util/Spliterator/SpliteratorTraversingAndSplittingTest.java#L91) one of the chosen sizes, so I think that's appropriate coverage. Naturally I confirmed that it does fail the tests as expected without the fix.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/29485#discussion_r2745337433
More information about the core-libs-dev
mailing list