>
> i guess that is what gwt.create does: generating one mapper per place 
> using the tokenizer code for implementation?
>

Only one mapper is generated. It contains a large generated if-then-else 
block that delegates getPlace() and getToken() to the correct Tokenizer 
based on the prefix (use -gen compiler option to see whats generated).

I think you only need one mocked mapper. If you want to test an activity 
the mocked mapper would do nothing except tracking method calls and its 
arguments as Thomas said. If your activity has a method "configureLinks()" 
that you want to test, it only matters that your activity calls 
mapper.getToken(...<place for each link that has to be configured>...) with 
the correct places as arguments inside this method. The mapper could also 
just return specific test strings per place (e.g. "a", "b", "c", ... so no 
real tokens created by tokenizers) because it only matters that these 
strings are set to the hyperlinks, it does not matter if theses strings are 
correctly generated by the mapper.

My code contains a Hyperlink instance so it would not work without 
GWTTestCase. Its just a short-hand code snippet. In reality you would have 
a method like updateLinkAToken(String token) in your view interface and the 
activity would do:

mockedView.updateLinkAToken(mockedMapper.getToken(new Place(....))).

As your mockedView and mockedMapper should not have a dependency to JSNI / 
GWT.create() it will work without a GWTTestCase.

-- J.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/00mvss5hxtUJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to