Are you tired of turning every non-trivial class into an interface, and then create an "Impl" that actually does the work when mocking objects for testing? <a href='http://garmhold.blogspot.com/2010/03/relax-you-can-mostly-stop-using.html' target='_blank'>Do you know about JMock's ClassImposterizer?</a> It allows you to mock instances without calling the constructor of the mocked class, ultimately helping you write and test your code faster. George Armhold writes:<blockquote>It's really hard to overstate the significance of this. It's changed the way I write and test code. It's very refreshing to be able to start out with a concrete class and write code that does stuff, rather than code that merely talks about doing stuff.</blockquote><a href='http://www.jmock.org/cheat-sheet.html' target='_blank'>JMock</a> can be used for striking a balance between an accurate specification of a unit's required behavior and a flexible test that allows easy evolution of the code base.").substring(0,300); return _diggURL ; } Are you tired of turning every non-trivial class into an interface, and then create an "Impl" that actually does the work when mocking objects for testing? Do you know about JMock's ClassImposterizer? It allows you to mock instances without calling the constructor of the mocked class, ultimately helping you write and test your code faster. George Armhold writes:
It's really hard to overstate the significance of this. It's changed the way I write and test code. It's very refreshing to be able to start out with a concrete class and write code that does stuff, rather than code that merely talks about doing stuff.JMock can be used for striking a balance between an accurate specification of a unit's required behavior and a flexible test that allows easy evolution of the code base.
| Message #333040 Post reply Post reply Post reply Go to top Go to top Go to top | |
| Click Here to read more... The comments to this entry are closed. |
Comments