<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Pencils Down &#187; JUnit</title>
	<atom:link href="http://www.dantoomeysoftware.com/pencils-down/tag/junit/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dantoomeysoftware.com/pencils-down</link>
	<description>This weblog is about my experiences in software development</description>
	<lastBuildDate>Fri, 27 Jan 2012 13:43:51 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>EasyMock IllegalArgumentException: not a proxy instance</title>
		<link>http://www.dantoomeysoftware.com/pencils-down/2011/04/05/easymock-illegalargumentexception-not-a-proxy-instance/</link>
		<comments>http://www.dantoomeysoftware.com/pencils-down/2011/04/05/easymock-illegalargumentexception-not-a-proxy-instance/#comments</comments>
		<pubDate>Tue, 05 Apr 2011 17:24:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[EasyMock]]></category>
		<category><![CDATA[JUnit]]></category>

		<guid isPermaLink="false">http://www.dantoomeysoftware.com/pencils-down/?p=198</guid>
		<description><![CDATA[This error is the result of trying to mock a class instead of an interface.  In order to mock a class you have to use the class extensions instead.
So, change your code from:
import static org.easymock.EasyMock.*;
To:
import static org.easymock.classextension.EasyMock.*;
I think it&#8217;s just historically how EasyMock got developed:

first interfaces like nice Java/Spring/JUnit theory says your supposed to develop,
then normal [...]]]></description>
			<content:encoded><![CDATA[<p>This error is the result of trying to <a href="http://easymock.org/">mock </a>a class instead of an interface.  In order to mock a class you have to use the class extensions instead.</p>
<p>So, change your code from:</p>
<p><code>import static org.easymock.EasyMock.*;</code></p>
<p>To:</p>
<p><code>import static org.easymock.classextension.EasyMock.*;</code></p>
<p>I think it&#8217;s just historically how EasyMock got developed:</p>
<ol>
<li>first interfaces like nice <a href="http://www.java.com">Java</a>/<a href="http://www.springsource.org/">Spring</a>/<a href="http://www.junit.org/">JUnit</a> theory says your supposed to develop,</li>
<li>then normal classes for the working Java programmers of the world.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.dantoomeysoftware.com/pencils-down/2011/04/05/easymock-illegalargumentexception-not-a-proxy-instance/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to EasyMock a Void Routine</title>
		<link>http://www.dantoomeysoftware.com/pencils-down/2011/03/23/how-to-easymock-a-void-routine/</link>
		<comments>http://www.dantoomeysoftware.com/pencils-down/2011/03/23/how-to-easymock-a-void-routine/#comments</comments>
		<pubDate>Wed, 23 Mar 2011 17:47:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[EasyMock]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[JUnit]]></category>
		<category><![CDATA[Software Tools]]></category>

		<guid isPermaLink="false">http://www.dantoomeysoftware.com/pencils-down/?p=192</guid>
		<description><![CDATA[EasyMock, like other JUnit mock testers, allows you to set expectations for method calls on the mocked object.  However, the expect() method wants to see a return type from the method call.  So, what to do?
A built-in mechanism of EasyMocks is to just &#8220;call&#8221; the void method in question.  For example a commonly mocked object [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://easymock.org/">EasyMock</a>, like other JUnit mock testers, allows you to set expectations for method calls on the mocked object.  However, the expect() method wants to see a return type from the method call.  So, what to do?</p>
<p>A built-in mechanism of EasyMocks is to just &#8220;call&#8221; the void method in question.  For example a commonly mocked object is the <a href="http://download.oracle.com/javaee/1.2.1/api/javax/servlet/http/HttpSession.html">HttpSession</a>:<br />
<code><br />
    expect(request.getSession()).andReturn(session);<br />
    expect(session.getAttribute(name)).andReturn(null);<br />
    session.setAttribute(eq(name), isA(InSession.class));<br />
    replay(session);<br />
    //whatever you are really trying to test<br />
    verify(session);</code></p>
<p>Could only be easier if the doc told you this clearly.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dantoomeysoftware.com/pencils-down/2011/03/23/how-to-easymock-a-void-routine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JUnit error &#8211; java.lang.Exception: No runnable methods</title>
		<link>http://www.dantoomeysoftware.com/pencils-down/2009/04/03/junit-error-javalangexception-no-runnable-methods/</link>
		<comments>http://www.dantoomeysoftware.com/pencils-down/2009/04/03/junit-error-javalangexception-no-runnable-methods/#comments</comments>
		<pubDate>Fri, 03 Apr 2009 20:18:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[JUnit]]></category>

		<guid isPermaLink="false">http://www.dantoomeysoftware.com/pencils-down/2009/04/03/junit-error-javalangexception-no-runnable-methods/</guid>
		<description><![CDATA[This error is a catchall for anything else that might be wrong with your test class.  First make sure any of the below problems are not occurring. 
Your unit test code is running JUnit4.  At least one test method must have the @Test annotation.  Otherwise this error occurs.
If the class you are testing has @Required setters [...]]]></description>
			<content:encoded><![CDATA[<p>This error is a catchall for anything else that might be wrong with your test class.  First make sure any of the below problems are not occurring. </p>
<p>Your unit test code is running JUnit4.  At least one test method must have the @Test annotation.  Otherwise this error occurs.</p>
<p>If the class you are testing has @Required setters for Spring injections they must be set otherwise JUnit will mask the missing required exception as a no runnable methods exception.</p>
<p>If you are initializing your mock objects outside of the @Begin method you will get this error.</p>
<p>If you are attempting to mock the same class more than once you will get this error.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dantoomeysoftware.com/pencils-down/2009/04/03/junit-error-javalangexception-no-runnable-methods/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

