I'm trying to use GWTMockUtilities in my project. I've posted this
question on the GXT forums[1], but also wanted to post it here to see
if anyone knows of a solution.

Here's my test:

    @Override
    public void setUp() {
        GWTMockUtilities.disarm();
        galleryController = new GalleryController();
    }

    @Override
    public void tearDown() {
        GWTMockUtilities.restore();
    }

    public void testCreateView() {
        Dispatcher dispatcher = Dispatcher.get();
        dispatcher.addController(galleryController);
        dispatcher.dispatch(AppEvents.ViewGallery);
        assertNotNull(galleryController.galleryView);
        assertTrue(galleryController.galleryView.isVisible());
    }

I get the following error when running the test:

java.lang.ExceptionInInitializerError
        at com.extjs.gxt.ui.client.mvc.Dispatcher.<init>(Dispatcher.java:124)
        at com.extjs.gxt.ui.client.mvc.Dispatcher.get(Dispatcher.java:111)
        at
org.richresume.client.gallery.GalleryControllerGwtTest.testCreateView
(GalleryControllerGwtTest.java:23)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
        at com.intellij.rt.execution.junit.JUnitStarter.main
(JUnitStarter.java:40)
Caused by: java.lang.NullPointerException
        at com.google.gwt.user.client.History.<clinit>(History.java:61)
        ... 21 more

History.java:61 is the 3nd line in the following code.

  static {
    impl = GWT.create(HistoryImpl.class);
    if (!impl.init()) {
      // Set impl to null as a flag to no-op future calls.
      impl = null;

      // Tell the user.
      GWT.log("Unable to initialize the history subsystem; did you "
          + "include the history frame in your host page? Try "
          + "<iframe src=\"javascript:''\" id='__gwt_historyFrame' "
          + "style='position:absolute;width:0;height:0;border:0'>"
          + "</iframe>", null);
    }
  }

As noted in a reply[2], this happens b/c GWT.create() returns null and
causes History.java to fail. Is it possible to use GWTMockUtilities
with History.java?

Thanks,

Matt

[1] http://extjs.com/forum/showthread.php?p=289942
[2] http://extjs.com/forum/showthread.php?p=289942#post289942
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to