On Fri, 20 Aug 2021 16:27:53 GMT, Ian Graves <igra...@openjdk.org> wrote:
>> 8271302: Regex Test Refresh > > Ian Graves has updated the pull request incrementally with one additional > commit since the last revision: > > some quick fixes test/jdk/java/util/regex/RegExTest.java line 4270: > 4268: String s = (String)pm[1]; > 4269: boolean r = (Boolean)pm[2]; > 4270: assertSame(r, Pattern.compile(p).matcher(s).matches()); `assertEquals(boolean, boolean)` might be better. test/jdk/java/util/regex/RegExTest.java line 4270: > 4268: String s = (String)pm[1]; > 4269: boolean r = (Boolean)pm[2]; > 4270: assertSame(r, Pattern.compile(p).matcher(s).matches()); `expectThrows(PatternSyntaxException.class, ...)` might suit better for this and similar cases in this file. Not only does `expectThrows` test for expected exception, it also returns an exception which you can further inspect. Now, if we only had `assertThat` or similar functionality for compound assertions, the complete test might've looked nicely. ------------- PR: https://git.openjdk.java.net/jdk/pull/5092