Hybrid View

    Success! Looks like we've fixed this one. According to our records the fix was applied for a bug in our system in a recent build.
  1. #1
    Ext GWT Premium Member
    Join Date
    Jan 2009
    Location
    Colorado Springs, CO
    Posts
    381
    Vote Rating
    5
    DavidHoffer is on a distinguished road

      0  

    Default Ho to mock GXT widgets?

    Ho to mock GXT widgets?


    GWT provides GWTMockUtilities which will disarm/restore calls to GWT.create so GWT can be tested using standard mocking frameworks such as EasyMock. How can I do the same for GXT widgets?

    The problem seems to be the GXT class has static members which call GWT.getModuleBaseURL(), and that method is not disarmed like create is. Is there a way around this? I've tried modifing GWTBridge to contain this method but it seems the original one is always loaded before mine.

  2. #2
    Sencha User
    Join Date
    Sep 2007
    Posts
    13,971
    Vote Rating
    132
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    I will open a ticket to remove the static initializer in GXT, as it is not really required. Thanks for bringing it up.

  3. #3
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,734
    Vote Rating
    90
    Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light

      0  

    Default


    Interesting class there David, thanks for pointing it out.

    I've made the necessary modifications to the GXT class, and I've added a few simple unit tests using Mockito to GXT to ensure that a decent sampling of classes are able to be mocked.

    The one main gotcha I found in that testing was the ToolButton, since all of those static images require GWT.create to not return null, else they will cause a NPE. I've build a mock class for when GWT.create is unwired, and it appears to pass these same tests. I've looked for all other invocations of GWT.create to ensure that we aren't using it for any static fields that could cause a NPE in class initialization, but haven't found any.

    This changeset is in SVN and the latest nightly builds, and will be available in the next release.

Thread Participants: 2