<?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: JUnit 4 &#8211; testing for exception, execution time and disabling a test</title>
	<atom:link href="http://veerasundar.com/blog/2009/07/junit-4-testing-for-exception-execution-time-and-disabling-a-test/feed/" rel="self" type="application/rss+xml" />
	<link>http://veerasundar.com/blog/2009/07/junit-4-testing-for-exception-execution-time-and-disabling-a-test/</link>
	<description></description>
	<lastBuildDate>Tue, 09 Mar 2010 16:53:34 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Veera</title>
		<link>http://veerasundar.com/blog/2009/07/junit-4-testing-for-exception-execution-time-and-disabling-a-test/comment-page-1/#comment-2456</link>
		<dc:creator>Veera</dc:creator>
		<pubDate>Mon, 18 Jan 2010 16:45:44 +0000</pubDate>
		<guid isPermaLink="false">http://veerasundar.com/blog/?p=568#comment-2456</guid>
		<description>There are two ways to test a method which does not return anything.

1. As &lt;a href=&quot;http://junit.sourceforge.net/doc/faq/faq.htm#tests_4&quot; rel=&quot;nofollow&quot;&gt;Junit FAQ&lt;/a&gt; says:
&lt;blockquote&gt;The method should have some &lt;i&gt;side effect&lt;/i&gt;. i.e. it might alter some external files or data. In that scenario, it is better to test that external data to see the success of the method.&lt;/blockquote&gt;

2. Use reflections to get the private variable, defined inside your method, in your JUnit test case and validate. Have a look at this article for more details:  &lt;a href=&quot;http://stackoverflow.com/questions/34571/whats-the-best-way-of-unit-testing-private-methods&quot; rel=&quot;nofollow&quot;&gt;What’s the best way of unit testing private methods?&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p>There are two ways to test a method which does not return anything.</p>
<p>1. As <a href="http://junit.sourceforge.net/doc/faq/faq.htm#tests_4" rel="nofollow">Junit FAQ</a> says:</p>
<blockquote><p>The method should have some <i>side effect</i>. i.e. it might alter some external files or data. In that scenario, it is better to test that external data to see the success of the method.</p></blockquote>
<p>2. Use reflections to get the private variable, defined inside your method, in your JUnit test case and validate. Have a look at this article for more details:  <a href="http://stackoverflow.com/questions/34571/whats-the-best-way-of-unit-testing-private-methods" rel="nofollow">What’s the best way of unit testing private methods?</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: abhay</title>
		<link>http://veerasundar.com/blog/2009/07/junit-4-testing-for-exception-execution-time-and-disabling-a-test/comment-page-1/#comment-2455</link>
		<dc:creator>abhay</dc:creator>
		<pubDate>Mon, 18 Jan 2010 02:25:33 +0000</pubDate>
		<guid isPermaLink="false">http://veerasundar.com/blog/?p=568#comment-2455</guid>
		<description>thanks for your reply, this makes sense for handling print statements, however the method to be tested also contains a local integer variable &#039;q&#039; which is neither printed, nor returned nor its value saved in some variable that exists outside the function. any ideas on how i would access this variable that exists inside the function only.  really appreciate the help</description>
		<content:encoded><![CDATA[<p>thanks for your reply, this makes sense for handling print statements, however the method to be tested also contains a local integer variable &#8216;q&#8217; which is neither printed, nor returned nor its value saved in some variable that exists outside the function. any ideas on how i would access this variable that exists inside the function only.  really appreciate the help</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Veera</title>
		<link>http://veerasundar.com/blog/2009/07/junit-4-testing-for-exception-execution-time-and-disabling-a-test/comment-page-1/#comment-2453</link>
		<dc:creator>Veera</dc:creator>
		<pubDate>Mon, 18 Jan 2010 01:10:40 +0000</pubDate>
		<guid isPermaLink="false">http://veerasundar.com/blog/?p=568#comment-2453</guid>
		<description>I don&#039;t think there is a easy way to do this. One solution I would suggest is:

1. Redirect your system.out.print messages to an external  file, using &lt;a href=&quot;http://java.sun.com/j2se/1.5.0/docs/api/java/lang/System.html#setOut(java.io.PrintStream)&quot; rel=&quot;nofollow&quot;&gt;System.setOut&lt;/a&gt; method.
2. From your JUnit read the output file and then parse to find the correct output pattern.</description>
		<content:encoded><![CDATA[<p>I don&#8217;t think there is a easy way to do this. One solution I would suggest is:</p>
<p>1. Redirect your system.out.print messages to an external  file, using <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/System.html#setOut(java.io.PrintStream)" rel="nofollow">System.setOut</a> method.<br />
2. From your JUnit read the output file and then parse to find the correct output pattern.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: abhay</title>
		<link>http://veerasundar.com/blog/2009/07/junit-4-testing-for-exception-execution-time-and-disabling-a-test/comment-page-1/#comment-2451</link>
		<dc:creator>abhay</dc:creator>
		<pubDate>Sun, 17 Jan 2010 18:56:33 +0000</pubDate>
		<guid isPermaLink="false">http://veerasundar.com/blog/?p=568#comment-2451</guid>
		<description>if my function does not return any value... it just sets the value of some (local to function) variable &#039;q&#039;, and generates System.out.println statements at the end, how do i JUnit test this method ... how do i Junit test print statements and some variable internal to function</description>
		<content:encoded><![CDATA[<p>if my function does not return any value&#8230; it just sets the value of some (local to function) variable &#8216;q&#8217;, and generates System.out.println statements at the end, how do i JUnit test this method &#8230; how do i Junit test print statements and some variable internal to function</p>
]]></content:encoded>
	</item>
</channel>
</rss>
