|
From: Nat P. <nat...@gm...> - 2006-03-02 17:46:58
|
The latter. In the final example you show the use of "new" in an expectation. We've tried to make that be considered bad style in jMock and always show using a factory function so that tests are expressive. It's not always caught on but more people use factory functions than not. --Nat. On 3/2/06, Mike Mason <mik...@gm...> wrote: > On 3/2/06, Nat Pryce <nat...@gm...> wrote: > > > Hi. Sorry I jumped the gun a bit here. The tutorials on the site are > fine. > > > > One suggestion: the tutorial should describe the idiom of creating > > factory methods for creating actions and matchers. Yes, you can do > > ...Will(new BlahBlahBlahAction()) but doing that makes tests hard to > > read. The whole point of jMock and NMock2 is to provide a embedded > > domain-specific language that can be seamlessly extended by users, and > > this should be demonstrated at every opportunity in the tutorials and > > documentation. The end result -- clear tests/specifications -- is > > really worth it. > > > > Not 100% sure what you mean here -- do you not like the part where we > explain how the syntactic sugar used earlier corresponds to new BlahBlah(= ), > or would you like something added suggesting that if you make your own > custom matchers, you should also create factory methods for them? > > Cheers, > Mike. > |