NullPointerException in dragTo method

WindowTester allows you to easily create and run unit tests for every GUI they build. It can also be used to generate system level tests.

Moderators: gnebling, Eric Clayberg, Dan Rubel, keertip, Phil Quitslund

NullPointerException in dragTo method

Postby fcoat » Mon Mar 07, 2011 7:27 am


Using a custom locator MDSFigureLocator returning a org.eclipse.draw2d.Figure, and trying to do a drag & drop, an exeption org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.NullPointerException) is thrown:

Code: Select all
public void testDragAndDrop() throws Exception {
   IUIContext ui = getUI();
   MDSFigureLocator source = new MDSFigureLocator(new ColumnMatcher("CUSTORDERLINE", "PRODUCTID"));
   MDSFigureLocator dest = new MDSFigureLocator(new ColumnMatcher("DIMPRODUCT", "PRODUCTID"));
   System.out.println("*** source: " + source.findAll(ui).length);  // displays "*** source: 1"
   System.out.println("*** dest: " + dest.findAll(ui).length);  // displays "*** dest: 1";  // works fine, the widget is properly clicked
   ui.dragTo(dest);  // fails with the exception below

org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.NullPointerException)
at org.eclipse.swt.SWT.error(
at org.eclipse.swt.SWT.error(
at org.eclipse.swt.widgets.Synchronizer.syncExec(
at org.eclipse.ui.internal.UISynchronizer.syncExec(
at org.eclipse.swt.widgets.Display.syncExec(
at com.windowtester.runtime.draw2d.internal.helpers.FigureSelectorHelper.ensureRunOnUIThread(
at com.windowtester.runtime.draw2d.internal.helpers.FigureSelectorHelper.scrollForClick(
at com.windowtester.runtime.draw2d.internal.selectors.FigureSelectorDelegate.dragTo(
at com.windowtester.runtime.swt.internal.UIContextSWT.dragTo(
at test.businessobjects.bimodeler.rcp.framework.testDragAndDrop(
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at junit.framework.TestCase.runTest(
at junit.framework.TestCase.runBare(
at com.windowtester.runtime.common.UITestCaseCommon.access$0(
at com.windowtester.runtime.common.UITestCaseCommon$
at com.windowtester.runtime.common.UITestCaseCommon$
at com.windowtester.internal.runtime.junit.core.SequenceRunner$
Caused by: java.lang.NullPointerException
at com.windowtester.runtime.draw2d.internal.helpers.FigureSelectorHelper$
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(
at org.eclipse.swt.widgets.Display.runAsyncMessages(
at org.eclipse.swt.widgets.Display.readAndDispatch(
at com.windowtester.runtime.swt.internal.junit.SWTExecutionMonitor.doWaitForFinish(
at com.windowtester.internal.runtime.junit.core.AbstractExecutionMonitor.waitUntilFinished(
at com.windowtester.internal.runtime.junit.core.SequenceRunner.waitUntilFinished(
at com.windowtester.internal.runtime.junit.core.SequenceRunner.exec(
at com.windowtester.runtime.common.UITestCaseCommon.runUITest(
at com.windowtester.runtime.common.UITestCaseCommon.runBare(
at junit.framework.TestResult$1.protect(
at junit.framework.TestResult.runProtected(
at junit.framework.TestSuite.runTest(

Is there a way to go around this issue ?

Posts: 4
Joined: Thu Feb 17, 2011 10:53 pm

Re: NullPointerException in dragTo method

Postby fcoat » Thu Mar 10, 2011 7:28 am

Any news regarding this issue ?
BTW, I am using WT 6.0 for Eclipse 3.4.

Posts: 4
Joined: Thu Feb 17, 2011 10:53 pm

Re: NullPointerException in dragTo method

Postby keertip » Mon Mar 28, 2011 8:28 am

Do you have some sample code and test that you could post so that we can reproduce this problem at our end? That would help a lot.
Posts: 221
Joined: Thu Mar 15, 2007 10:26 am

Return to Window Tester

Who is online

Users browsing this forum: No registered users and 1 guest