JDK 9 RFR of JDK-8023897: Replace/update/rename executeAndCatch in various tests to assertThrows

Daniel Fuchs daniel.fuchs at oracle.com
Wed May 3 13:50:59 UTC 2017


On 03/05/2017 05:19, Amy Lu wrote:
> On 5/3/17 12:53 AM, Daniel Fuchs wrote:
>> Is that why you decided to drop the description?
>
> I tried best to keep the useful message, EmptyNavigableMap
> EmptyNavigableSet are examples. For Map/Defaults.java, most cases'
> message are test's description and/or "should throw NPE", such
> information already in the output.
>
>
> The only exception is for testReplaceAllNoNullReplacement, the message
>     " should not allow replacement with null value"
> for case
>     map.replaceAll((k,v) -> null)
> is dropped. I just think that it might not worth with extra function for
> just this one usage only.
>
> I’ll make this message as a one-line comment when push.

OK. When the messages are not informative I guess it's OK
to drop them. Though as others have expressed it would be
good to have an Assert.assertThrows methods that takes
an additional string as argument!

best regards,

-- daniel

>
> Thanks,
> Amy
>
>>
>> best regards
>>
>> -- daniel
>>
>> On 02/05/2017 10:19, Amy Lu wrote:
>>> Please review this test-only change.
>>>
>>> Some java/util tests use a function executeAndCatch which essentially
>>> asserts that an exception is thrown, while some other tests use
>>> assertThrows for doing the same work. For both cases, with jtreg
>>> upgraded to testng 6.9.5 (CODETOOLS-7901639), test can then leverage
>>> TestNG Assert.assertThrows
>>>
>>> Please review the patch to update executeAndCatch and assertThrows to
>>> Assert.assertThrows for java/util testng tests.
>>>
>>> bug: https://bugs.openjdk.java.net/browse/JDK-8023897
>>> webrev: http://cr.openjdk.java.net/~amlu/8023897/webrev.00/
>>>
>>> Thanks,
>>> Amy
>>>
>>
>



More information about the core-libs-dev mailing list