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.
News: Relax: You Can (Mostly) Stop Using Java Interfaces For Testing
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:
- Posted by: Eugene Ciurana
- Posted on: March 09 2010 10:07 EST
- Re: Relax: You Can (Mostly) Stop Using Java Interfaces For Testing by Jess Holle on March 09 2010 16:21 EST
- Re: Relax: You Can (Mostly) Stop Using Java Interfaces For Testing by Marc Stock on March 10 2010 03:31 EST
- Re: Relax: You Can (Mostly) Stop Using Java Interfaces For Testing by John Shuster on March 10 2010 10:53 EST
- Re: Relax: You Can (Mostly) Stop Using Java Interfaces For Testing by Jon Alvarado on March 10 2010 12:50 EST
Or you could just use jmockit...
Or you could just use Mockito...
or you could use easymock + the class extension. It's been around for years. How is this news?
I prefer the Unitils http://unitils.com/ mock testing framework.
You got a really useful blog I have been here reading for about an hour. pass4sure E20-591 Useful information like this one must be kept and maintained so I will put this one on my bookmark list! pass4sure 642-832 Thanks for this wonderful post and hoping to post more of this blog here. pass4sure 642-437 I am a newbie and your success is very much an inspiration for me.