Search the web
Sign In
New User? Sign Up
junit · JUnit, the Java unit testing framework written by Kent Beck and Erich Gamma.
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Want to share photos of your group with the world? Add a group photo to Flickr.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Testing non-public classes in different packages   Message List  
Reply | Forward Message #21840 of 22233 |
Hi,

I've got a question concerning tests on non-public classes. Is there any
possibility to test these classes if they are located in a different package?
I'm thinking of something equal to setAccessible(true) for functions. Now I know
that this won't work with classes as they are not derived from AccessibleObject.
To load the class outside the package I use something like

Class myClass = Class.forName("reflection.classes.MyClass");

But if I try

Object instance = myClass.newInstance();

I get an IllegalAccessException.

Anyone knows about this?
Thanks!




Wed Jul 22, 2009 8:19 am

maier.georg...
Offline Offline
Send Email Send Email

Forward
Message #21840 of 22233 |
Expand Messages Author Sort by Date

Hi, I've got a question concerning tests on non-public classes. Is there any possibility to test these classes if they are located in a different package? I'm...
maier.georg@...
maier.georg...
Offline Send Email
Jul 22, 2009
10:24 pm

If the package is signed, then there might be an issue. But there is nothing prohibiting you from writing you test class inside the package of the class you...
Mike Forsberg
bigmike_f
Offline Send Email
Jul 24, 2009
1:14 am
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help