<?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: Testing hard to test code with EasyMock</title>
	<atom:link href="http://eclipsesource.com/blogs/2009/07/11/tip-making-hard-to-test-code-testable-with-easymock/feed/" rel="self" type="application/rss+xml" />
	<link>http://eclipsesource.com/blogs/2009/07/11/tip-making-hard-to-test-code-testable-with-easymock/</link>
	<description>Eclipse Equinox OSGi</description>
	<lastBuildDate>Sat, 20 Mar 2010 03:13:03 +0100</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Carlus</title>
		<link>http://eclipsesource.com/blogs/2009/07/11/tip-making-hard-to-test-code-testable-with-easymock/comment-page-1/#comment-2156</link>
		<dc:creator>Carlus</dc:creator>
		<pubDate>Mon, 13 Jul 2009 17:16:42 +0000</pubDate>
		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=2380#comment-2156</guid>
		<description>Love EasyMock.  It is absolutely great.  

Something that I would recommend is the use of the IMockControl object.  Using the IMockControl, you code can change from this:

EasyMock.replay(nodeA);
EasyMock.replay(nodeB);
EasyMock.replay(nodeC);

// execute logic....

EasyMock.verify(nodeA);
EasyMock.verify(nodeB)
EasyMock.verify(nodeC)

To this:

setup() {
mockControl = EasyMock.createControl();
nodeA = mockControl.createMock(ISubApplicationNode.class);
nodeB = mockControl.createMock(ISubApplicationNode.class);
nodeC = mockControl.createMock(ISubApplicationNode.class);
}

testX() {
expect(nodeA).andReturn();
expect(nodeB).andReturn();

...
mockControl.replay();

// execute logic

mockControl.verify();

}

Found this niceness by asking questions on the mailing list....

Enjoy...</description>
		<content:encoded><![CDATA[<p>Love EasyMock.  It is absolutely great.  </p>
<p>Something that I would recommend is the use of the IMockControl object.  Using the IMockControl, you code can change from this:</p>
<p>EasyMock.replay(nodeA);<br />
EasyMock.replay(nodeB);<br />
EasyMock.replay(nodeC);</p>
<p>// execute logic&#8230;.</p>
<p>EasyMock.verify(nodeA);<br />
EasyMock.verify(nodeB)<br />
EasyMock.verify(nodeC)</p>
<p>To this:</p>
<p>setup() {<br />
mockControl = EasyMock.createControl();<br />
nodeA = mockControl.createMock(ISubApplicationNode.class);<br />
nodeB = mockControl.createMock(ISubApplicationNode.class);<br />
nodeC = mockControl.createMock(ISubApplicationNode.class);<br />
}</p>
<p>testX() {<br />
expect(nodeA).andReturn();<br />
expect(nodeB).andReturn();</p>
<p>&#8230;<br />
mockControl.replay();</p>
<p>// execute logic</p>
<p>mockControl.verify();</p>
<p>}</p>
<p>Found this niceness by asking questions on the mailing list&#8230;.</p>
<p>Enjoy&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert Konigsberg</title>
		<link>http://eclipsesource.com/blogs/2009/07/11/tip-making-hard-to-test-code-testable-with-easymock/comment-page-1/#comment-2078</link>
		<dc:creator>Robert Konigsberg</dc:creator>
		<pubDate>Sat, 11 Jul 2009 18:41:29 +0000</pubDate>
		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=2380#comment-2078</guid>
		<description>I&#039;m starting to use EasyMock; it&#039;s pretty nice, if a little messy. The classextension package has some really nice behavior.</description>
		<content:encoded><![CDATA[<p>I&#8217;m starting to use EasyMock; it&#8217;s pretty nice, if a little messy. The classextension package has some really nice behavior.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marek Romanowski</title>
		<link>http://eclipsesource.com/blogs/2009/07/11/tip-making-hard-to-test-code-testable-with-easymock/comment-page-1/#comment-2068</link>
		<dc:creator>Marek Romanowski</dc:creator>
		<pubDate>Sat, 11 Jul 2009 07:58:24 +0000</pubDate>
		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=2380#comment-2068</guid>
		<description>If you tried EasyMock and you find it useful, then try Mockito too. I&#039;ve been using both libraries and find Mockito a little bit more developer friendly (in term of writing code). Project is availible at mockito.org (http://code.google.com/p/mockito/).</description>
		<content:encoded><![CDATA[<p>If you tried EasyMock and you find it useful, then try Mockito too. I&#8217;ve been using both libraries and find Mockito a little bit more developer friendly (in term of writing code). Project is availible at mockito.org (<a href="http://code.google.com/p/mockito/" rel="nofollow">http://code.google.com/p/mockito/</a>).</p>
]]></content:encoded>
	</item>
</channel>
</rss>
