Re: How to get @Prefix value from an Place.Tokenizer? or how to set via clientbundle constants?
i have one problem with this solution: testability since i generate those links in an activity i want test it without GwtTestCase. But using my AppPlaceHistoryMapper smells like the need for GWTTestCase?! i think i will refactor my code and give the place a string constant (public or with getter) and use this as prefix - good idea? -- 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/-/1Q6hkGJQ5VMJ. 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.
Re: How to get @Prefix value from an Place.Tokenizer? or how to set via clientbundle constants?
Oh yes I think you will need a GWTTestCase as the mapper is created with GWT.create(). I did not had that in mind because I have implemented PlaceHistoryMapper myself (nicer url scheme) so there is no need for GWT.create(). -- 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/-/FQKDpaApn94J. 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.
Re: How to get @Prefix value from an Place.Tokenizer? or how to set via clientbundle constants?
Isn't that what mocks are for? -- 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/-/bQ_3M5iyC8MJ. 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.
Re: How to get @Prefix value from an Place.Tokenizer? or how to set via clientbundle constants?
i guess you mean to implement my own PlaceHistoryMapper - only for test? that could work but now i am happy with my getPrefix() in place-class. With this i don't need a dependency to historymapper in my activity. (it don't feels right to use historymapper to get a constant string from a place?!) -- 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/-/kanCwAlsz3AJ. 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.
Re: How to get @Prefix value from an Place.Tokenizer? or how to set via clientbundle constants?
On Wednesday, October 26, 2011 3:51:12 PM UTC+2, tanteanni wrote: i guess you mean to implement my own PlaceHistoryMapper - only for test? that could work Yes, with the added benefit that you could test whether you call the PlaceHistoryMapper with the appropriate argument, not whether the returned value from the place-to-string conversion is the one you expect (which will change when you change your PlaceTokenizer, but you're not testing your PlaceTokenizer here, you're testing your activity, and if the test changes when the implementation of another class changes –without breaking the contract: turn a place into a string–, it's no longer a *unit* test; and it also means you'd have to change all your tests when you decide to change what your PlaceTokenizer generates/parses). With a mock, the exact output wouldn't matter, the input would however: does my activity calls the mapper with the appropriate argument? but now i am happy with my getPrefix() in place-class. With this i don't need a dependency to historymapper in my activity. (it don't feels right to use historymapper to get a constant string from a place?!) Well, the goal of PlaceHistoryMapper *is* to get a string out of a place (and the reverse). Whether it's used by the PlaceHistoryHandler or your code the builds link doesn't really matter. -- 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/-/kYVjqqZJVPgJ. 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.
Re: How to get @Prefix value from an Place.Tokenizer? or how to set via clientbundle constants?
thx! once again i learned a lot :-) -- 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/-/j91qOXlWMjoJ. 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.
Re: How to get @Prefix value from an Place.Tokenizer? or how to set via clientbundle constants?
ok some questions remain: i just implemented my AppHistoryMapper. I need one implementation per place, right? (i guess that is what gwt.create does: generating one mapper per place using the tokenizer code for implementation?) with this mock in place: is the code provided bei jens (myHyperLink.setTargetHistoryToken(mapper.getToken(new MyPlace(stateVar1, stateVar2, ...)));)) working without gwtTestCase? Which part is extracting the prefix from place (some where in setTargetHistoryToken?)? -- 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/-/p4mNBTfjbG4J. 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.
Re: How to get @Prefix value from an Place.Tokenizer? or how to set via clientbundle constants?
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 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.
Re: How to get @Prefix value from an Place.Tokenizer? or how to set via clientbundle constants?
You can use: AppPlaceHistoryMapper mapper = ... //get mapper somehow myHyperLink.setTargetHistoryToken(mapper.getToken(new MyPlace(stateVar1, stateVar2, ...))); -- 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/-/Mf0brbZahcgJ. 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.
Re: How to get @Prefix value from an Place.Tokenizer? or how to set via clientbundle constants?
thx! that is exactly what i am looking for. -- 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/-/X-FXQ8uw25gJ. 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.