I just installed Netbeans 11.3, on windows 10 running JDK 14. I tried to follow
the simple 10 minutes learning tutorial provided at
https://netbeans.apache.org/kb/docs/java/javase-intro.html just to get my feet
wet. Everything worked fine until I reached the section under "Creating JUnits
Tests". The IDE does a good job in generating the code for the JUnit test
class, however, the test fails with Could not find or load main class error.
Here is the stack trace from the output window:
compile-test:
Created dir: C:\Users\....\Documents\NetBeansProjects\MyLib\build\test\results
Testsuite: org.me.mylib.LibClassTest
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.152 sec
Testcase: initializationError(org.me.mylib.LibClassTest): Caused an ERROR
No runnable methods
java.lang.Exception: No runnable methods
at
java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
at
java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at
java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at
java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)
Test org.me.mylib.LibClassTest FAILED
The exception seems to take place during the test initialization, internal to
the JUnit fram
I have all the libs (mentioned in the tutorial) added to the project and they
appear in the classpath.
Any insights will be helpful
Thanks