PDA

View Full Version : YUIExHelper.setTheme causes problem in JUnit



Setya
23 Mar 2007, 1:33 AM
Hi all,

I use yui-ext on my GWT app. When I run it through JUnit it throws the following exception:


com.google.gwt.core.client.JavaScriptException: JavaScript TypeError exception: '$wnd.YAHOO.ext' is null or not an object
at com.google.gwt.dev.shell.ie.ModuleSpaceIE6.invokeNative(ModuleSpaceIE6.java:435)
at com.google.gwt.dev.shell.ie.ModuleSpaceIE6.invokeNativeHandle(ModuleSpaceIE6.java:211)
at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeHandle(JavaScriptHost.java:93)
at com.netthreads.gwt.yuiext.client.ElementExtImpl.create(ElementExtImpl.java:29)
at com.netthreads.gwt.yuiext.client.ElementExt.create(ElementExt.java:42)
at com.netthreads.gwt.yuiext.client.YUIExHelper.setTheme(YUIExHelper.java:39)
at com.soltius.cms.client.CmsEntryPoint.onModuleLoad(CmsEntryPoint.java:15)
at com.soltius.cms.client.ToolbarUITest.testAddRemoveToolbarImage(ToolbarUITest.java:10)
at com.soltius.cms.client.__ToolbarUITest_unitTestImpl.doRunTest(transient source for com.soltius.cms.client.__ToolbarUITest_unitTestImpl:11)
at com.google.gwt.junit.client.impl.GWTTestCaseImpl.runTest(GWTTestCaseImpl.java:295)
at com.google.gwt.junit.client.impl.GWTTestCaseImpl.access$1(GWTTestCaseImpl.java:289)
at com.google.gwt.junit.client.impl.GWTTestCaseImpl$JUnitHostListener.onSuccess(GWTTestCaseImpl.java:65)
at com.google.gwt.junit.client.impl.JUnitHost_Proxy$2.onCompletionImpl(transient source for com.google.gwt.junit.client.impl.JUnitHost_Proxy:130)
at com.google.gwt.junit.client.impl.JUnitHost_Proxy$2.onCompletion(transient source for com.google.gwt.junit.client.impl.JUnitHost_Proxy:104)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at com.google.gwt.dev.shell.ie.IDispatchImpl.callMethod(IDispatchImpl.java:107)
at com.google.gwt.dev.shell.ie.IDispatchProxy.invoke(IDispatchProxy.java:140)
at com.google.gwt.dev.shell.ie.IDispatchImpl.Invoke(IDispatchImpl.java:274)
at com.google.gwt.dev.shell.ie.IDispatchImpl.method6(IDispatchImpl.java:177)
at org.eclipse.swt.internal.ole.win32.COMObject.callback6(COMObject.java:117)
at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1925)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2966)
at com.google.gwt.dev.GWTShell.pumpEventLoop(GWTShell.java:657)
at com.google.gwt.junit.JUnitShell.runTestImpl(JUnitShell.java:337)
at com.google.gwt.junit.JUnitShell.runTest(JUnitShell.java:120)
at com.google.gwt.junit.client.GWTTestCase.runTest(GWTTestCase.java:177)
at com.google.gwt.junit.client.GWTTestCase.run(GWTTestCase.java:114)

The exception apparently caused by the following statement in my EntryPoint class:


...
YUIExHelper.setTheme("ytheme-gray");
...

When I remove the above statement JUnit runs fine.

Application also runs fine if I run it outside JUnit (even with above statement).


Any help would be greatly appreciated.


Best Regards,

Setya