eclipse / Xpect

This repository has been rewritten to move to the Eclipse Foundation. Find the old history here: https://github.com/TypeFox/Xpect
http://www.xpect-tests.org/
Eclipse Public License 2.0
32 stars 28 forks source link

NPE #164

Closed toshovski closed 9 years ago

toshovski commented 9 years ago

I recieve an Null Pointer Exception when I try to run my tests. I have the latest version of xpect installed. Any idea how to fix that?

!ENTRY org.eclipse.core.jobs 4 2 2015-02-25 10:37:05.985
!MESSAGE An internal error occurred during: "Launching MyXpectTests".
!STACK 0
java.lang.NullPointerException
    at org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate$ClasspathLocalizer.localURL(JUnitLaunchConfigurationDelegate.java:431)
    at org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate$ClasspathLocalizer.entryString(JUnitLaunchConfigurationDelegate.java:413)
    at org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate$ClasspathLocalizer.addEntry(JUnitLaunchConfigurationDelegate.java:405)
    at org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate$ClasspathLocalizer.localizeClasspath(JUnitLaunchConfigurationDelegate.java:396)
    at org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate.getClasspath(JUnitLaunchConfigurationDelegate.java:373)
    at org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate.launch(JUnitLaunchConfigurationDelegate.java:147)
    at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:885)
    at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:739)
    at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1039)
    at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1256)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
meysholdt commented 9 years ago

That NPE occurs if you execute a test's launch config in an Eclipse that does not have the plugin org.eclipse.jdt.junit4.runtime.patch installed when the launch config was created by an Eclipse that did actually have org.eclipse.jdt.junit4.runtime.patch installed.

Workaround: Install org.eclipse.jdt.junit4.runtime.patch via the Xpect update site or delete+recreate your launch configuration.

org.eclipse.jdt.junit4.runtime.patch is required in Eclipse < Mars to execute all Xpect tests from a single file from the JUnit view.

In Eclipse Mars, that patch is not needed anymore: http://blog.moritz.eysholdt.de/2014/11/new-eclipse-junit-feature-run-subtrees.html

see: https://github.com/meysholdt/eclipse_jdt_junit_runners/tree/master/org.eclipse.jdt.junit4.runtime.patch

toshovski commented 9 years ago

Thank you. I'll try the patch tomorrow.