RFR: 8285405: add test and check for negative argument to HashMap::newHashMap et al

Lance Andersen lancea at openjdk.org
Tue Aug 9 18:09:02 UTC 2022


On Tue, 9 Aug 2022 09:36:28 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:

> (This is a recreation of a previous pull request which had received some reviews https://github.com/openjdk/jdk/pull/9036. I had to delete that personal branch and recreate it due to some git issues)
> 
> Can I please get a review of this change which addresses https://bugs.openjdk.java.net/browse/JDK-8285405?

Changes requested by lancea (Reviewer).

test/jdk/java/util/HashMap/WhiteBoxResizeTest.java line 452:

> 450:         try {
> 451:             method.apply(-1);
> 452:             // expected to fail but didn't

You could use `assert.throws(IllegalArgumenException.class, () -> method.apply(-1));`. which would be a bit cleaner IMHO

-------------

PR: https://git.openjdk.org/jdk/pull/9806


More information about the core-libs-dev mailing list