Hamlet D'Arcy has been writing software for over a decade, and has spent considerable time coding in C++, Java, and Groovy. He's passionate about learning new languages and different ways to think about problems, and recently he's been discovering the joys of both F# and Scheme. He's an active member of the Groovy Users of Minnesota and the Object Technology User Group, is a committer on the Groovy project, and is a contributor on a few open source projects (including JConch and the IDEA Groovy Plugin). He blogs regularly at http://hamletdarcy.blogspot.com and can be found on Twitter as HamletDRC (http://twitter.com/hamletdrc). Hamlet is a DZone MVB and is not an employee of DZone and has posted 28 posts at DZone. You can read more from them at their website. View Full User Profile

Mock Objects with Spock Screencast

07.13.2011
| 8855 views |
  • submit to reddit

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:

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:

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

Published at DZone with permission of Hamlet D'Arcy, author and DZone MVB.

(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

Thanks for taking the time to do this presentation. Quick question: Are you disabling static code analysis in IntelliJ in lieu of some other mechanism (codenarc)? I see that your code isn't causing any rules to fire where mine does for the identical code. This is especially noticeable when using the wildcards. We have recently moved to Spock and I am finding that the IntelliJ static code analyzer complains a lot about things that are hard to ignore globally like compatible types, closures, etc. I like having at least the default set of analysis rules enabled. We do also have codenarc running during our builds to help identify other violations. Is there a way to tune down IntelliJ via module or class name perhaps?

Spring Framework

Sirikant Noori replied on Sat, 2012/03/31 - 6:37am

Thanks for taking the time to do this presentation.

Quick question: Are you disabling static code analysis in IntelliJ in lieu of some other mechanism (codenarc)?

jsp

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.