You can't use GWT.create() in a non-GWTTestCase. If you'd like to mock
it out you need to use GWTMockUtilities.disarm() and then restore()
after.

--
Arthur Kalmenson



On Thu, Jul 23, 2009 at 8:56 AM, Dalla<dalla_man...@hotmail.com> wrote:
>
> I have a testcase that runs like it should using jUnit4.
> I´m curious if anyone can tell me how I would write the same testcase
> using jMock?
>
> @Test
>        public void testNextDateButton() {
>                HandlerManager eventBus = new HandlerManager(null);
>
>                GreetingServiceAsync service = 
> GWT.create(GreetingService.class);
>
>                MockNavigationWidget navigationWidget = new 
> MockNavigationWidget();
>                NavigationPresenter navigationPresenter = new 
> NavigationPresenter
> (navigationWidget, eventBus, service);
>
>                MockOrderListWidget listWidget = new MockOrderListWidget();
>                OrderListPresenter orderListPresenter = new OrderListPresenter
> (listWidget, eventBus);
>
>                Date date = new Date();
>
>                navigationWidget.hasValueDate.setValue(date);
>                
> Assert.assertEquals(date,navigationWidget.hasValueDate.getValue());
>
>                navigationWidget.nextClickHandler.lastClickHandler.onClick(new
> MockClickEvent());
>                Assert.assertEquals(date.getTime() + 86400000L,
> navigationWidget.hasValueDate.lastValue.getTime());
> }
>
> Cheers!
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to