Re: How to use Mockito for testing Async calls?

2011-08-14 Thread pete
And of course you can just define your Async interface methods by Request myAsyncMethod(AsyncCallbackString callback); instead of void myAsyncMethod(AsyncCallbackString callback); then you can use normal Mockito-syntax, ala when(service.myAsyncMethod(any(AsyncCallback.class))).thenAnswer(new

Re: How to use Mockito for testing Async calls?

2011-08-13 Thread pete
I always though this produced nicely readable tests for async calls: http://blog.reflectedcircle.co.uk/2009/12/08/gwt-rpc-asynccallback-testing-using-mockito/ Greetz On Aug 12, 11:24 am, Magno Machado magn...@gmail.com wrote: Code from a @Test method: ListPesquisaProxy pesquisas = new

Re: How to use Mockito for testing Async calls?

2011-08-12 Thread Magno Machado
Code from a @Test method: ListPesquisaProxy pesquisas = new ArrayListPesquisaProxy(); Request? request = mock(Request.class); doReturn(request).when(pesquisaRequest).listAll(); doReturn(pesquisaRequest).when(requestFactory).pesquisaRequest();

How to use Mockito for testing Async calls?

2011-08-11 Thread yogi
Hi all, I want to know how to use Mockito for testing Async calls. I went through few blogs, and I am not sure it is implemented and how it runs. For instance, if I have an server implementation as: public class GreetingServiceImpl extends RemoteServiceServlet implements GreetingService

Re: How to use Mockito for testing Async calls?

2011-08-11 Thread Miroslav Genov
In my experience, using of mocking frameworks for testing of Async calls is not so good and tests are becoming un-readable at some point of time. In our app we are using Command Pattern to send different requests (Action/Response) and here is our helper class that we are using for testing:

Re: How to use Mockito for testing Async calls?

2011-08-11 Thread Juan Pablo Gardella
you can see gwt-dispatch http://code.google.com/p/gwt-dispatch/ for command pattern. 2011/8/11 Miroslav Genov mge...@gmail.com In my experience, using of mocking frameworks for testing of Async calls is not so good and tests are becoming un-readable at some point of time. In our app we are

Re: How to use Mockito for testing Async calls?

2011-08-11 Thread objectuser
Here's how I do it. @Test public void testAsync() { doAnswer(new AnswerVoid() { @Override public Void answer(InvocationOnMock invocation) throws Throwable { AsyncCallbackCommandResult callback = (AsyncCallbackCommandResult)