<i18n dev> RFR: 8271302: Regex Test Refresh [v3]

Pavel Rappo prappo at openjdk.java.net
Fri Aug 20 17:01:28 UTC 2021


On Fri, 20 Aug 2021 16:49:15 GMT, Pavel Rappo <prappo at openjdk.org> wrote:

>> 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());
> 
> `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.

The latter comment referred to hand-rolled try-fail constructs like this: https://github.com/openjdk/jdk/blob/3937bf8f9921395d6fcbdc2bb00a4a98dc2aaf62/test/jdk/java/util/regex/RegExTest.java#L4281-L4289

Not sure why my IDE plugin messed up the comment position.

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

PR: https://git.openjdk.java.net/jdk/pull/5092


More information about the i18n-dev mailing list