<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	>
<channel>
	<title>Comments on: Grails Unit Testing: How to mock a closure</title>
	<atom:link href="http://www.englishteeth.co.uk/2008/08/29/grails-unit-testing-how-to-mock-a-closure/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.englishteeth.co.uk/2008/08/29/grails-unit-testing-how-to-mock-a-closure/</link>
	<description>... the weblog of Ian "English Teeth" Robinson</description>
	<pubDate>Sat, 31 Jul 2010 23:03:43 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Pete McKinstry</title>
		<link>http://www.englishteeth.co.uk/2008/08/29/grails-unit-testing-how-to-mock-a-closure/comment-page-1/#comment-3714</link>
		<dc:creator>Pete McKinstry</dc:creator>
		<pubDate>Mon, 27 Jul 2009 18:51:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.englishteeth.co.uk/?p=78#comment-3714</guid>
		<description>Thanks for the tip. This was a big help. 

The one modification I made was to have the closuure return a PagedResultList (same as the CriteriaBuilder.list() method). I was using the totalCount property in the controller to enable pagination on the UI so it was necessary. 

Again, thanks a bunch. 

-pgm</description>
		<content:encoded><![CDATA[<p>Thanks for the tip. This was a big help. </p>
<p>The one modification I made was to have the closuure return a PagedResultList (same as the CriteriaBuilder.list() method). I was using the totalCount property in the controller to enable pagination on the UI so it was necessary. </p>
<p>Again, thanks a bunch. </p>
<p>-pgm</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ian</title>
		<link>http://www.englishteeth.co.uk/2008/08/29/grails-unit-testing-how-to-mock-a-closure/comment-page-1/#comment-137</link>
		<dc:creator>Ian</dc:creator>
		<pubDate>Fri, 03 Oct 2008 16:03:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.englishteeth.co.uk/?p=78#comment-137</guid>
		<description>Hi Justin, the above definitely worked for me.

Your stubbed version of the list method - is it definitely the list method of your domain object that the controller is accessing?

What I mean is, if it's not the same signature and does not match the meta class method you've replaced, you will just get the real one being invoked.</description>
		<content:encoded><![CDATA[<p>Hi Justin, the above definitely worked for me.</p>
<p>Your stubbed version of the list method - is it definitely the list method of your domain object that the controller is accessing?</p>
<p>What I mean is, if it&#8217;s not the same signature and does not match the meta class method you&#8217;ve replaced, you will just get the real one being invoked.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Justin</title>
		<link>http://www.englishteeth.co.uk/2008/08/29/grails-unit-testing-how-to-mock-a-closure/comment-page-1/#comment-136</link>
		<dc:creator>Justin</dc:creator>
		<pubDate>Thu, 02 Oct 2008 18:40:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.englishteeth.co.uk/?p=78#comment-136</guid>
		<description>Were you able to get this to work? When I tried something similar, I found that my stubbed version of the list call (Customer.metaClass.static.list = { Map params -&gt; testItems }) was never invoked and instead the real one would be called.

I'm curious to know whether you got this to work.</description>
		<content:encoded><![CDATA[<p>Were you able to get this to work? When I tried something similar, I found that my stubbed version of the list call (Customer.metaClass.static.list = { Map params -&gt; testItems }) was never invoked and instead the real one would be called.</p>
<p>I&#8217;m curious to know whether you got this to work.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: englishteeth.co.uk &#187; Groovy on Grails and my &#8220;Test First&#8221; impasse</title>
		<link>http://www.englishteeth.co.uk/2008/08/29/grails-unit-testing-how-to-mock-a-closure/comment-page-1/#comment-120</link>
		<dc:creator>englishteeth.co.uk &#187; Groovy on Grails and my &#8220;Test First&#8221; impasse</dc:creator>
		<pubDate>Thu, 04 Sep 2008 14:10:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.englishteeth.co.uk/?p=78#comment-120</guid>
		<description>[...] that this can be done as a closure to the list method of hibernate criteria and having figured out how to mock a closure I can assert that a filter has indeed been [...]</description>
		<content:encoded><![CDATA[<p>[...] that this can be done as a closure to the list method of hibernate criteria and having figured out how to mock a closure I can assert that a filter has indeed been [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>
