Community
Participate
Working Groups
Using Eclipse3.6M7 If I try to run the launch configuration "All DS Tests" provided by the project org.eclipse.equinox.ds.tests it fails to run because of a ClassCastException (see below). This happens if I run with JDK1.5+. If I run it with JDK1.4.2 the configuration is successfully run. java.lang.ClassCastException: junit.framework.TestSuite cannot be cast to junit.framework.Test at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestLoader.getTest(JUnit3TestLoader.java:108) at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestLoader.loadTests(JUnit3TestLoader.java:59) 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.pde.internal.junit.runtime.RemotePluginTestRunner.main(RemotePluginTestRunner.java:62) at org.eclipse.pde.internal.junit.runtime.CoreTestApplication.run(CoreTestApplication.java:23) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.eclipse.equinox.internal.app.EclipseAppContainer.callMethodWithException(EclipseAppContainer.java:587) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:198) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574) at org.eclipse.equinox.launcher.Main.run(Main.java:1407) at org.eclipse.equinox.launcher.Main.main(Main.java:1383) Steps to reproduce: - import the project org.eclipse.equinox.ds.tests from the rt repository (it is located here: org.eclipse.equinox/compendium/bundles/org.eclipse.equinox.ds.tests) - run the junit launch configuration "All DS Tests" with JDK1.5 or higher I have debugged the problem and it seems that it is caused because there are two "org.junit" bundles with different versions in the target platform. When running the configuration, PDE selects the bundle with higher version and this causes the problem. It is strange that this problem does not happen when running the launch configuration of project osgi.tests. It seems identical as the one of ds.tests.
Markus, is this a JUnit 3 vs. 4 issue?
Yes, see bug 296104. I always said the org.junit plug-ins should be singletons, so that such problems can at least be detected by OSGi, but I've been overruled.
*** This bug has been marked as a duplicate of bug 296104 ***
Stoyan, I figured out why ds.tests is failing to work but osgi.tests is working. Your test bundle puts a limit on the import-package range. If you remove the Import-Package for junit and instead use Require-Bundle on junit with no range then it seems to work.
(In reply to comment #4) > Stoyan, I figured out why ds.tests is failing to work but osgi.tests is > working. Your test bundle puts a limit on the import-package range. If you > remove the Import-Package for junit and instead use Require-Bundle on junit > with no range then it seems to work. Thanks Thomas! It works this way