Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is my test not running [closed]

Tags:

java

junit

Strangest thing happened my test was running ok and now its not anymore I didn't change the code at all here is the exception :

Class not found com.example.test
java.lang.ClassNotFoundException: com.example.test
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClass(RemoteTestRunner.java:693)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClasses(RemoteTestRunner.java:429)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
like image 341
Gandalf StormCrow Avatar asked Oct 15 '25 14:10

Gandalf StormCrow


1 Answers

I see that you are using Eclipse, but are you also using some other external build/test tool like Ant or Maven? Sometimes Eclipse can get out of sync when also using other external tools.

If you are using external tools, do whatever is necessary to clean up generated artifacts (e.g. mvn clean). Then refresh the Eclipse project and do a clean build as suggested previously. Then try running your unit test again using Eclipse.

Good luck and hope this helps.

like image 58
cjstehno Avatar answered Oct 17 '25 03:10

cjstehno



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!