wood burning stoves 2.0*
The moose likes GWT and the fly likes create Junit Test case for my Presentation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » GWT
Bookmark "create Junit Test case for my Presentation" Watch "create Junit Test case for my Presentation" New topic
Author

create Junit Test case for my Presentation

manish jaiswal
Greenhorn

Joined: Aug 15, 2011
Posts: 5
I am trying to create Junit Test case for my Presentation Layer , while creating Presentation instance in setup method of Junit it goes througn GWT.Create at this point it fails saying

java.lang.ExceptionInInitializerError
.
.
Caused by: java.lang.UnsupportedOperationException: ERROR: GWT.create() is only usable in client code! It cannot be called, for example, from server code. If you are running a unit test, check that your test case extends GWTTestCase and that GWT.create() is not called from within an initializer or constructor.
at com.google.gwt.core.client.GWT.create(GWT.java:91)
at com.google.gwt.user.client.ui.UIObject.<clinit>(UIObject.java:188)
... 24 more

and when I add following line to deal with GWT.Create case

@BeforeClass
public static void disarm() {
GWTMockUtilities.disarm();
}

@AfterClass
public static void rearm() {
GWTMockUtilities.restore();
}


it gives Null pointer exception .. Please help me on that...

Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10175
    
    8

check that your test case extends GWTTestCase and that GWT.create() is not called from within an initializer or constructor.

So does your code satisfy these conditions?


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
manish jaiswal
Greenhorn

Joined: Aug 15, 2011
Posts: 5
Yes Maneesh I think I need to check my code for the last condation (not called from within an initializer or constructor)again...


Regards
Manish
 
Consider Paul's rocket mass heater.
 
subject: create Junit Test case for my Presentation
 
Similar Threads
JUnit Testing
GWT AsyncCallback is not responding - Response is also fine shown by FireBug
Calling multiple methods from RPC servlet
Trouble using addTestSuite() vs. addTest()
JUnit Test