<?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: No more excuses: junit testing log messages</title>
	<atom:link href="http://giordano.scalzo.biz/2009/10/21/no-more-excuses-junit-testing-log-messages/feed/" rel="self" type="application/rss+xml" />
	<link>http://giordano.scalzo.biz/2009/10/21/no-more-excuses-junit-testing-log-messages/</link>
	<description>Just another useless weblog</description>
	<lastBuildDate>Sun, 29 Jan 2012 05:27:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
	<item>
		<title>By: Andrea Cerisara</title>
		<link>http://giordano.scalzo.biz/2009/10/21/no-more-excuses-junit-testing-log-messages/comment-page-1/#comment-35</link>
		<dc:creator>Andrea Cerisara</dc:creator>
		<pubDate>Thu, 22 Oct 2009 19:36:43 +0000</pubDate>
		<guid isPermaLink="false">http://giordano.scalzo.biz/?p=192#comment-35</guid>
		<description>To clarify myself, for example (without interface, using an object seam):

in LoggingObject
&lt;pre class=&#039;brush: java&#039;&gt;
protected Logger logger()
{
    return Logger.getLogger(LoggingObject.class);
}

public void starts()
{
    logger().info(&quot;I&#039;m starting&quot;);
}
&lt;/pre&gt;

in ALoggingObject

&lt;pre class=&#039;brush: java&#039;&gt;
private Logger logger;

@Before
public void setUp()
{
    logger = mock(Logger.class);
    loggingObject = new LoggingObject()
    {
        @Override
        public Logger logger()
        {
            return logger;
        }
    };
}

@Test
public void shouldLogWhenStarts()
{
    loggingObj.starts();
    verify(logger).info(&quot;I&#039;m starting&quot;);
}
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>To clarify myself, for example (without interface, using an object seam):</p>
<p>in LoggingObject</p>
<pre class='brush: java'>
protected Logger logger()
{
    return Logger.getLogger(LoggingObject.class);
}

public void starts()
{
    logger().info("I'm starting");
}
</pre>
<p>in ALoggingObject</p>
<pre class='brush: java'>
private Logger logger;

@Before
public void setUp()
{
    logger = mock(Logger.class);
    loggingObject = new LoggingObject()
    {
        @Override
        public Logger logger()
        {
            return logger;
        }
    };
}

@Test
public void shouldLogWhenStarts()
{
    loggingObj.starts();
    verify(logger).info("I'm starting");
}
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andrea Cerisara</title>
		<link>http://giordano.scalzo.biz/2009/10/21/no-more-excuses-junit-testing-log-messages/comment-page-1/#comment-34</link>
		<dc:creator>Andrea Cerisara</dc:creator>
		<pubDate>Thu, 22 Oct 2009 19:15:20 +0000</pubDate>
		<guid isPermaLink="false">http://giordano.scalzo.biz/?p=192#comment-34</guid>
		<description>That&#039;s true, but you have a static dependency that, in my opinion, makes hard to test your object. Just a thought anyway :-)</description>
		<content:encoded><![CDATA[<p>That&#8217;s true, but you have a static dependency that, in my opinion, makes hard to test your object. Just a thought anyway <img src='http://giordano.scalzo.biz/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: giordano scalzo</title>
		<link>http://giordano.scalzo.biz/2009/10/21/no-more-excuses-junit-testing-log-messages/comment-page-1/#comment-32</link>
		<dc:creator>giordano scalzo</dc:creator>
		<pubDate>Thu, 22 Oct 2009 15:39:32 +0000</pubDate>
		<guid isPermaLink="false">http://giordano.scalzo.biz/?p=192#comment-32</guid>
		<description>mmm
in fact RecordingAppender it&#039;s just a kind of test double ;-)
I agree with you, that injecting that responsibility should be more clear.

Thanks for your suggestion</description>
		<content:encoded><![CDATA[<p>mmm<br />
in fact RecordingAppender it&#8217;s just a kind of test double <img src='http://giordano.scalzo.biz/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /><br />
I agree with you, that injecting that responsibility should be more clear.</p>
<p>Thanks for your suggestion</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andrea Cerisara</title>
		<link>http://giordano.scalzo.biz/2009/10/21/no-more-excuses-junit-testing-log-messages/comment-page-1/#comment-31</link>
		<dc:creator>Andrea Cerisara</dc:creator>
		<pubDate>Thu, 22 Oct 2009 14:07:28 +0000</pubDate>
		<guid isPermaLink="false">http://giordano.scalzo.biz/?p=192#comment-31</guid>
		<description>Correct me if I&#039;m wrong, but it seems to me that LoggingObject is a business object: in that case I would probably extract the logging functionality to an interface and test it through an interaction test with some kind of test double.</description>
		<content:encoded><![CDATA[<p>Correct me if I&#8217;m wrong, but it seems to me that LoggingObject is a business object: in that case I would probably extract the logging functionality to an interface and test it through an interaction test with some kind of test double.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

