Oh, so easy to miss. Better yet use TestNG's Assert.fail, or for simple cases declare the expected exception as an argument of the test annotation.
Paul. > On Jun 1, 2020, at 12:39 PM, Martin Buchholz <marti...@google.com> wrote: > > Missing "throw"; We should have an assertThrows test method (many > people have written such, including myself). > > + try { > + new StringJoiner(maxString, maxString, "").toString(); > + new AssertionError("Should have thrown OutOfMemoryError"); > > On Mon, Jun 1, 2020 at 8:58 AM Jim Laskey <james.las...@oracle.com> wrote: >> >> Change NegativeArraySizeException to OutOfMemoryError. Tests added. >> >> Cheers, >> >> -- Jim >> >> webrev: http://cr.openjdk.java.net/~jlaskey/8230743/webrev-00/index.html >> <http://cr.openjdk.java.net/~jlaskey/8230743/webrev-00/index.html> >> jbs: https://bugs.openjdk.java.net/browse/JDK-8230743 >> <https://bugs.openjdk.java.net/browse/JDK-8230743> >>