Bug 99099 - Tests on protected methods fail
Tests on protected methods fail
Status: VERIFIED INVALID
Product: java
Classification: Unclassified
Component: JUnit
5.x
PC Windows XP
: P2 with 1 vote (vote)
: TBD
Assigned To: Marian Petras
junit-issues@java
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-03-27 11:46 UTC by ulfzibis
Modified: 2007-11-24 16:35 UTC (History)
0 users

See Also:
Issue Type: DEFECT
:


Attachments
Project tree (262.21 KB, application/octet-stream)
2007-03-27 11:52 UTC, ulfzibis
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ulfzibis 2007-03-27 11:46:03 UTC
See project files attached!

Test class sun.jdbc.odbc.JdbcOdbcDriver__Test was created by NetBeans tool, but
does not run because of error:

Testcase: testGetAttributeProperties(sun.jdbc.odbc.JdbcOdbcDriver__Test):	Caused
an ERROR
tried to access method
sun.jdbc.odbc.JdbcOdbcDriver.getAttributeProperties(Ljava/lang/String;)Ljava/util/Hashtable;
from class sun.jdbc.odbc.JdbcOdbcDriver__Test
java.lang.IllegalAccessError: tried to access method
sun.jdbc.odbc.JdbcOdbcDriver.getAttributeProperties(Ljava/lang/String;)Ljava/util/Hashtable;
from class sun.jdbc.odbc.JdbcOdbcDriver__Test
        at
sun.jdbc.odbc.JdbcOdbcDriver__Test.testGetAttributeProperties(JdbcOdbcDriver__Test.java:251)
Comment 1 ulfzibis 2007-03-27 11:52:35 UTC
Created attachment 40020 [details]
Project tree
Comment 2 ulfzibis 2007-07-05 16:02:01 UTC
This issue also occurs on NB 6.0.
Comment 3 ulfzibis 2007-07-14 22:01:34 UTC
I've also submitted this issue to the JUnit project:

https://sourceforge.net/tracker/?func=detail&atid=115278&aid=1753683&group_id=15278

Please actuate them to find the fixing.
Comment 4 Marian Petras 2007-07-18 14:11:20 UTC
Calling protected methods from other classes within the same package works without problems in simple J2SE projects - I
tried that.

I looked at your project and noticed that you fiddle with classpaths and bootclasspaths quite a bit. I also found
information that two classes stored in packages of the same name, but loaded by different classloaders are not
considered as being from the same package (see http://access1.sun.com/techarticles/DR-article.html) which implies that
protected methods from one class are not accessible from the other class. I suspect your problem is caused by exactly
this. As a workaround, create a public method in the tested class (let's call it "xfinalize") which only calls the
finalize() method. From the test, call xfinalize() instead of finalize().

If you find that I am wrong, feel free to reopen the issue.
Comment 5 ulfzibis 2007-07-18 23:01:16 UTC
Hi,

Thanx very much for your hints!

I've found out another tricky possibility (file project.properties):
run.jvmargs=-Xbootclasspath/p:${build.classes.dir};${build.test.classes.dir};"${netbeans.home}/../java1/modules/ext/junit-3.8.2.jar"

What you think about it?
Comment 6 ulfzibis 2007-07-18 23:05:48 UTC
But ...
By this trick the ant script is not independent from the IDE.

Do you have an idea to avoid this?
Comment 7 ulfzibis 2007-07-19 00:31:31 UTC
Perhaps define properties like:
test.lib="${netbeans.home}/../java1/modules/ext/junit-3.8.2.jar"
run.test.jvmargs=${run.jvmargs};${build.test.classes.dir};${test.lib}
Comment 8 Marian Petras 2007-07-20 15:43:15 UTC
I am sorry, your concerns of the correct setup of classpaths do not justify reopening this bug report. Marked as INVALID
(again).
Comment 9 ulfzibis 2007-11-24 16:35:15 UTC
Verified with 6.0 RC2.

Enhancements copied to issue 122677.


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo