Mock Objects with Spock Screencast
This screencast demonstrates how to use Spock testing specifications and Groovy for mocking and stubbing behavior in unit tests. It covers creating the mock object syntax, setting expectations, verifying and spying on results, and argument matchers.
If you have any issues with video playback, then trying viewing it from the JBrains.tv website
Here are some useful links to read for this webcast:
- Spock Framework - http://code.google.com/p/spock/
- Spock Basics Screencast: http://tv.jetbrains.net/videocontent/ffff
- Mocks and Stubs aren't Spies: http://hamletdarcy.blogspot.com/2007/10/mocks-and-stubs-arent-spies.html
- Mocking with Spocks: http://www.canoo.com/blog/2010/04/20/spock-and-test-spies-a-logical-choice/
I've made a lot of screencasts and blog posts over the years. If you like this, then there are many ways to see the other stuff I've done:
- My main blog: http://hamletdarcy.blogspot.com
- My other JetBrains.tv posts: http://tv.jetbrains.net/tags/hamlet
- IDEA related posts on my blog: http://hamletdarcy.blogspot.com/search/label/IDEA
- My screencasts on YouTube: http://www.youtube.com/user/HamletDRC
- IDEA related Posts on my work blog: http://www.canoo.com/blog/tag/idea/
- Or follow me on Twitter: @HamletDRC
Phew, that's a lot of self-promotion :)
The screencast was created with Ubuntu 10.04, PiTiVi, Audicity, gtk-RecordMyDesktop, IntelliJ IDEA, and LibreOffice. OS from top to bottom.
Thanks for watching, and leave a comment!
From http://hamletdarcy.blogspot.com/2011/07/mock-objects-with-spock-screencast.html
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)






Comments
Robert Craft replied on Thu, 2012/01/26 - 5:34am
Spring Framework
Sirikant Noori replied on Sat, 2012/03/31 - 6:37am
Quick question: Are you disabling static code analysis in IntelliJ in lieu of some other mechanism (codenarc)? jsp