neo09 / gwt-platform

Automatically exported from code.google.com/p/gwt-platform
0 stars 0 forks source link

Document unit testing presenters #143

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Provide some useful tips about how to provide mock dispatch handlers.

Original issue reported on code.google.com by brendanp...@gmail.com on 20 Jul 2010 at 4:33

GoogleCodeExporter commented 9 years ago
In one of my project, I wrote a utility class to mock the dispatcher and set it 
up with call like:

mockDispatcher.when( GetClientDetails.class ).thenSucceed( new 
GetClientDetailsResult(client) );

Maybe we could offer something like that?

Original comment by philippe.beaudoin on 20 Jul 2010 at 4:47

GoogleCodeExporter commented 9 years ago
That sounds cool.  We'd want to actions with different values, so something 
like.

mockDispatcher.when( new GetClientAction(1) ).thenSucceed( new 
GetClientDetailsResult(client1) );
mockDispatcher.when( new GetClientAction(2) ).thenSucceed( new 
GetClientDetailsResult(client2) );

I'll modify my test cases and get back to you.

Original comment by brendanp...@gmail.com on 23 Jul 2010 at 1:19

GoogleCodeExporter commented 9 years ago
Yes, I never got around do doing something that fancy... :)

Original comment by philippe.beaudoin on 23 Jul 2010 at 1:35

GoogleCodeExporter commented 9 years ago
Classes to assist with testing.

http://codereview.appspot.com/1871048/show

Original comment by brendanp...@gmail.com on 26 Jul 2010 at 11:13

GoogleCodeExporter commented 9 years ago
Doing the review right now.

Original comment by philippe.beaudoin on 7 Aug 2010 at 6:58

GoogleCodeExporter commented 9 years ago
I really like this! Much better than any testing code or helpers I've written 
myself.

I suggest you address the minor issues mentioned in the review then we can pull 
this into the trunk and start using it in samples, see Issue 152.

Original comment by philippe.beaudoin on 7 Aug 2010 at 7:26

GoogleCodeExporter commented 9 years ago
Addressed minor issues. New patch is at http://codereview.appspot.com/1871048/

Original comment by brendanp...@gmail.com on 29 Aug 2010 at 1:10

GoogleCodeExporter commented 9 years ago
Committed revision 46e9ff8ab4

Original comment by brendanp...@gmail.com on 3 Sep 2010 at 3:02

GoogleCodeExporter commented 9 years ago

Original comment by philippe.beaudoin on 3 Sep 2010 at 3:06