Placing tests in java.lang package (for testing protected methods)
tomasz.kowalczewski at gmail.com
Wed May 27 12:35:40 UTC 2015
Thank you, that was exactly what I needed for jtreg.
On Tue, May 26, 2015 at 11:27 AM, Alan Bateman <Alan.Bateman at oracle.com>
> On 26/05/2015 10:04, Tomasz Kowalczewski wrote:
>> I am trying to test a protected method of java.lang.String. Is this
>> possible with jtreg? If I specify:
>> * @run testng java.lang.StringIndexOfCharSequenceTest
>> package java.lang;
>> I will (unsurprisingly) get "SecurityException: Prohibited package name:
>> java.lang". I was thinking that there may be some jtreg magic to circumvent
>> Protected or package private? I assume the latter, in which case the
> test class will need to be in java.lang with the boot loader as the
> defining loader. Outside of the test harness then you could do this with
> As a jtreg test then the magic property to add to TEST.properties is
> bootclasspath.dirs to specify the directory with the classes to be loaded
> by the boot loader. Jon or others might have more to say on this but I
> think this feature is somewhat limited to TestNG tests, I don't think I've
> seen it used for anything other than TestNG tests. You'll see examples in
> the jdk repo, specifically in jdk/test/java/util/stream.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the jtreg-use