Comprehensive Pros/Cons of Mocking Frameworks for GWT

后端 未结 2 499
星月不相逢
星月不相逢 2021-01-03 08:20

I\'m interested in using the right mocking framework for my GWT app. It\'s my understanding that Mockito, EasyMock, and jMock are some of the most popular for Java. Could so

2条回答
  •  南笙
    南笙 (楼主)
    2021-01-03 08:51

    We're happily using Gwt-test-utils for our GWT project.

    Mocking RPC calls with mockito is really easy :

    First you declare your mocked service in your test :

    @Mock
    private ServiceAsync service;
    

    then when you want to mock a successful callback :

    doSuccessCallback(result).when(service).myMethod(eq("argument"), any(AsyncCallback.class));
    

    More on that : http://code.google.com/p/gwt-test-utils/wiki/MockingRpcServices

提交回复
热议问题