public void testSomething()
{
final Label label = new Label ( "gwt-maven-plugin Archetype ::
Project myGroupId.myArtifactId" );
RootPanel.get("aaa").add( label );
}
And in Application.html i add <div id="aaa"></div>
All works ok, but in JUnit test (mvn gwt:test) RootPanel.get("aaa")
throws
java.lang.NullPointerException
[INFO] at myGroupId.client.GwtTestSample.testSomething
(GwtTestSample.java:23)
[INFO] at myGroupId.client.__GwtTestSample_unitTestImpl.doRunTest
(transient source for myGroupId.client.__GwtTestSample_unitTestImpl:7)
[INFO] at junit.framework.TestCase.runTest(TestCase.java:62)
[INFO] at com.google.gwt.junit.client.GWTTestCase.runBare
(GWTTestCase.java:206)
[INFO] at com.google.gwt.junit.client.GWTTestCase.__doRunTest
(GWTTestCase.java:137)
[INFO] at com.google.gwt.junit.client.impl.GWTRunner.runTest
(GWTRunner.java:188)
[INFO] at com.google.gwt.junit.client.impl.GWTRunner.doRunTest
(GWTRunner.java:163)
[INFO] at com.google.gwt.junit.client.impl.GWTRunner.access$3
(GWTRunner.java:157)
[INFO] at com.google.gwt.junit.client.impl.GWTRunner
$JUnitHostListener.onSuccess(GWTRunner.java:61)
[INFO] at com.google.gwt.junit.client.impl.GWTRunner
$JUnitHostListener.onSuccess(GWTRunner.java:1)
[INFO] at
com.google.gwt.user.client.rpc.impl.RequestCallbackAdapter.onResponseReceived
(RequestCallbackAdapter.java:215)
[INFO] at
com.google.gwt.http.client.Request.fireOnResponseReceivedImpl
(Request.java:264)
[INFO] at com.google.gwt.http.client.Request.fireOnResponseReceived
(Request.java:229)
[INFO] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[INFO] at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
[INFO] at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
[INFO] at java.lang.reflect.Method.invoke(Method.java:597)
[INFO] at com.google.gwt.dev.shell.MethodAdaptor.invoke
(MethodAdaptor.java:103)
[INFO] at com.google.gwt.dev.shell.moz.MethodDispatch.invoke
(MethodDispatch.java:80)
[INFO] at org.eclipse.swt.internal.gtk.OS._g_main_context_iteration
(Native Method)
[INFO] at org.eclipse.swt.internal.gtk.OS.g_main_context_iteration
(OS.java:1428)
[INFO] at org.eclipse.swt.widgets.Display.readAndDispatch
(Display.java:2840)
[INFO] at com.google.gwt.dev.SwtHostedModeBase.processEvents
(SwtHostedModeBase.java:235)
[INFO] at com.google.gwt.dev.HostedModeBase.pumpEventLoop
(HostedModeBase.java:558)
[INFO] at com.google.gwt.junit.JUnitShell.runTestImpl(JUnitShell.java:
652)
[INFO] at com.google.gwt.junit.JUnitShell.runTest(JUnitShell.java:
346)
[INFO] at com.google.gwt.junit.client.GWTTestCase.runTest
(GWTTestCase.java:219)
[INFO] at junit.framework.TestCase.runBare(TestCase.java:134)
[INFO] at junit.framework.TestResult$1.protect(TestResult.java:110)
[INFO] at junit.framework.TestResult.runProtected(TestResult.java:
128)
[INFO] at junit.framework.TestResult.run(TestResult.java:113)
[INFO] at junit.framework.TestCase.run(TestCase.java:124)
[INFO] at com.google.gwt.junit.client.GWTTestCase.run
(GWTTestCase.java:132)
[INFO] at junit.framework.TestSuite.runTest(TestSuite.java:232)
[INFO] at junit.framework.TestSuite.run(TestSuite.java:227)
[INFO] at org.codehaus.mojo.gwt.test.MavenTestRunner.doRun
(MavenTestRunner.java:105)
[INFO] at junit.textui.TestRunner.start(TestRunner.java:180)
[INFO] at org.codehaus.mojo.gwt.test.MavenTestRunner.main
(MavenTestRunner.java:63)
Help.
Thanks.
hazy1
unread,
Jul 3, 2009, 10:58:36 PM7/3/09
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Google Web Toolkit
I have the same problem. No solution/work around that I know of.
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Google Web Toolkit
The work around I ended up using is to parameterize the RootPanel.get
("xxx") call with a public static member. In my JUnit test cases, I
set this public static to null prior to calling onModuleLoad.