Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 261593 - dev-util/netbeans-6.5-r4 fail when using junit
Summary: dev-util/netbeans-6.5-r4 fail when using junit
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: x86 Linux
: High normal
Assignee: Java team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-03-07 17:42 UTC by Anders Kreinøe
Modified: 2009-03-08 12:35 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
A simple netbeans projekt, with one class, and one junit test that fails. (SimpleJunitTestProject.tar.bz2,14.52 KB, application/octet-stream)
2009-03-07 18:09 UTC, Anders Kreinøe
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Anders Kreinøe 2009-03-07 17:42:08 UTC
When running junit, it fail, with an "caused an error".


Reproducible: Always

Steps to Reproduce:
run a junit test inside netbeans.

Actual Results:  
The test return the followin result: 
Testcase: initializationError(simplejunittestproject.TestClassTest):        Caused an ERROR
org/hamcrest/SelfDescribing
java.lang.NoClassDefFoundError: org/hamcrest/SelfDescribing
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
        at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
Caused by: java.lang.ClassNotFoundException: org.hamcrest.SelfDescribing
        at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)


Expected Results:  
The test should succed

I will attach a simple test program, which fails when running the junit test.
Comment 1 Anders Kreinøe 2009-03-07 18:09:41 UTC
Created attachment 184252 [details]
A simple netbeans projekt, with one class, and one junit test that fails.
Comment 2 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2009-03-07 18:18:45 UTC
Reassigning to java herd.
Comment 3 Miroslav Šulc gentoo-dev 2009-03-08 12:35:05 UTC
Our netbeans uses symlink to junit-4 jar which does not contain hamcrest classes, these are part of hamcrest-core and hamcrest packages. Simply add one of these to you project's test classpath and the tests should not fail.

Junit creates two releases: http://sourceforge.net/project/shownotes.php?release_id=618683&group_id=15278
We create the one that is just junit, no extra classes from different projects whereas netbeans uses the other one.

I also grepped the netbeans tree to find out whether I can inject hamcrest jar there so it would be added to classpath along with junit-4 but that would mean to create modified org.netbeans.libs.junit4 module and once this module would be updated through update center, the behavior would return to the one that is now so it makes no sense to do it. The other way is to create junit-4 jar that contains hamcrest but that's against how java packages are packaged.

So adding hamcrest to the project's test classpath (if needed, not all junit tests need hamcrest) is the only solution imo.