<?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: Mocking collaborating Abstract class using EasyMock partial mocking</title>
	<atom:link href="http://blog.xebia.com/2007/06/18/mocking-collaborating-abstract-class-using-easymock-partial-mocking/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.xebia.com/2007/06/18/mocking-collaborating-abstract-class-using-easymock-partial-mocking/</link>
	<description>Software development done right!</description>
	<lastBuildDate>Wed, 08 Feb 2012 14:41:38 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Naveen Kumar</title>
		<link>http://blog.xebia.com/2007/06/18/mocking-collaborating-abstract-class-using-easymock-partial-mocking/#comment-50359</link>
		<dc:creator>Naveen Kumar</dc:creator>
		<pubDate>Mon, 18 Aug 2008 07:01:58 +0000</pubDate>
		<guid isPermaLink="false">http://blog.xebia.com/2007/06/18/mocking-collaborating-abstract-class-using-easymock-partial-mocking/#comment-50359</guid>
		<description>download 
cglib-nodep-2.1_3.jar from 
http://www.java2s.com/Code/Jar/Spring-Related/Downloadcglibnodep213jar.htm
add into classpath, it will work.
Hope this helps.</description>
		<content:encoded><![CDATA[<p>download<br />
cglib-nodep-2.1_3.jar from<br />
<a href="http://www.java2s.com/Code/Jar/Spring-Related/Downloadcglibnodep213jar.htm" rel="nofollow">http://www.java2s.com/Code/Jar/Spring-Related/Downloadcglibnodep213jar.htm</a><br />
add into classpath, it will work.<br />
Hope this helps.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nattu</title>
		<link>http://blog.xebia.com/2007/06/18/mocking-collaborating-abstract-class-using-easymock-partial-mocking/#comment-48737</link>
		<dc:creator>Nattu</dc:creator>
		<pubDate>Thu, 31 Jul 2008 10:33:07 +0000</pubDate>
		<guid isPermaLink="false">http://blog.xebia.com/2007/06/18/mocking-collaborating-abstract-class-using-easymock-partial-mocking/#comment-48737</guid>
		<description>i am not able to run this testExpressAnger successfully. It gives me 
java.lang.NoClassDefFoundError: net/sf/cglib/proxy/Enhancer

I used EasyMock2.3 and EasyMockClassExtension2.2.2</description>
		<content:encoded><![CDATA[<p>i am not able to run this testExpressAnger successfully. It gives me<br />
java.lang.NoClassDefFoundError: net/sf/cglib/proxy/Enhancer</p>
<p>I used EasyMock2.3 and EasyMockClassExtension2.2.2</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Xebia Blog</title>
		<link>http://blog.xebia.com/2007/06/18/mocking-collaborating-abstract-class-using-easymock-partial-mocking/#comment-10119</link>
		<dc:creator>Xebia Blog</dc:creator>
		<pubDate>Mon, 25 Jun 2007 18:36:21 +0000</pubDate>
		<guid isPermaLink="false">http://blog.xebia.com/2007/06/18/mocking-collaborating-abstract-class-using-easymock-partial-mocking/#comment-10119</guid>
		<description>[...] If you&#039;re not overriding any methods, the EasyMock partial mocking feature, which was presented in this blog entry, works as a charm. However if we&#039;re extending a component, we probably want to override some of its methods and have it present a somewhat different behaviour. Let&#039;s take a look at a small sample:   public class CustomTree extends org.apache.myfaces.custom.tree2.HtmlTree &#123; &#160; private String nodeId; [...]</description>
		<content:encoded><![CDATA[<p>[...] If you&#8217;re not overriding any methods, the EasyMock partial mocking feature, which was presented in this blog entry, works as a charm. However if we&#8217;re extending a component, we probably want to override some of its methods and have it present a somewhat different behaviour. Let&#8217;s take a look at a small sample:   public class CustomTree extends org.apache.myfaces.custom.tree2.HtmlTree &#123; &nbsp; private String nodeId; [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Deepak Mittal</title>
		<link>http://blog.xebia.com/2007/06/18/mocking-collaborating-abstract-class-using-easymock-partial-mocking/#comment-9839</link>
		<dc:creator>Deepak Mittal</dc:creator>
		<pubDate>Thu, 21 Jun 2007 03:22:48 +0000</pubDate>
		<guid isPermaLink="false">http://blog.xebia.com/2007/06/18/mocking-collaborating-abstract-class-using-easymock-partial-mocking/#comment-9839</guid>
		<description>Hi Lars, 

Very valid &amp; useful comments. Didn&#039;t have these potential issues in mind, when I wrote this blog. I agree that it might be better to have some duplicate tests than to mock the methods in this manner. 

But I assume there would be scenarios when we would be extending an abstract class in a third-party library in our application, though I could not recall an example quickly. In such cases, &quot;partial mocking&quot; seems to be a good option.</description>
		<content:encoded><![CDATA[<p>Hi Lars, </p>
<p>Very valid &#038; useful comments. Didn&#8217;t have these potential issues in mind, when I wrote this blog. I agree that it might be better to have some duplicate tests than to mock the methods in this manner. </p>
<p>But I assume there would be scenarios when we would be extending an abstract class in a third-party library in our application, though I could not recall an example quickly. In such cases, &#8220;partial mocking&#8221; seems to be a good option.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lars Vonk</title>
		<link>http://blog.xebia.com/2007/06/18/mocking-collaborating-abstract-class-using-easymock-partial-mocking/#comment-9663</link>
		<dc:creator>Lars Vonk</dc:creator>
		<pubDate>Mon, 18 Jun 2007 11:52:51 +0000</pubDate>
		<guid isPermaLink="false">http://blog.xebia.com/2007/06/18/mocking-collaborating-abstract-class-using-easymock-partial-mocking/#comment-9663</guid>
		<description>Hi Deepak,

Interesting technology but I think you should be cautious in using this technique for the following reasons: 

- Refactoring support - Lets say you want to rename the speak method. Because the test refers to the speak method with the method name as String if does not get refactored (not in Eclipse that is). The same goes for adding parameters.

- Using this technique you wind up in focusing on what the method does instead of what it should do. I think (unit) tests should focus on what code should do.

I would prefer to exhaustively test the superclass speak() method separately and briefly test the expressAnger() method (which will test the speak() method again) in the concrete subclass. This might cause some duplication, but I rather have that then all these mocks.</description>
		<content:encoded><![CDATA[<p>Hi Deepak,</p>
<p>Interesting technology but I think you should be cautious in using this technique for the following reasons: </p>
<p>- Refactoring support &#8211; Lets say you want to rename the speak method. Because the test refers to the speak method with the method name as String if does not get refactored (not in Eclipse that is). The same goes for adding parameters.</p>
<p>- Using this technique you wind up in focusing on what the method does instead of what it should do. I think (unit) tests should focus on what code should do.</p>
<p>I would prefer to exhaustively test the superclass speak() method separately and briefly test the expressAnger() method (which will test the speak() method again) in the concrete subclass. This might cause some duplication, but I rather have that then all these mocks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter Veentjer</title>
		<link>http://blog.xebia.com/2007/06/18/mocking-collaborating-abstract-class-using-easymock-partial-mocking/#comment-9643</link>
		<dc:creator>Peter Veentjer</dc:creator>
		<pubDate>Mon, 18 Jun 2007 08:34:31 +0000</pubDate>
		<guid isPermaLink="false">http://blog.xebia.com/2007/06/18/mocking-collaborating-abstract-class-using-easymock-partial-mocking/#comment-9643</guid>
		<description>Thanks Deepak for the useful information. 

I normally extract the logic so I can test it, but this result in a lot of clutter (although with closures the clutter can be reduced because you need less interfaces).

But good to know how it works.. It will prevent  long test methods (where all methods are tested and not just one in isolation).</description>
		<content:encoded><![CDATA[<p>Thanks Deepak for the useful information. </p>
<p>I normally extract the logic so I can test it, but this result in a lot of clutter (although with closures the clutter can be reduced because you need less interfaces).</p>
<p>But good to know how it works.. It will prevent  long test methods (where all methods are tested and not just one in isolation).</p>
]]></content:encoded>
	</item>
</channel>
</rss>
<!-- This Quick Cache file was built for (  blog.xebia.com/2007/06/18/mocking-collaborating-abstract-class-using-easymock-partial-mocking/feed/ ) in 0.45211 seconds, on Feb 9th, 2012 at 10:07 pm UTC. -->
<!-- This Quick Cache file will automatically expire ( and be re-built automatically ) on Feb 9th, 2012 at 11:07 pm UTC -->
