<?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"
	>
<channel>
	<title>Comments on: BeanInitializer: wiring dependencies in unit tests</title>
	<atom:link href="http://blog.springsource.com/2007/04/02/beaninitializer-wiring-dependencies-in-unit-tests/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.springsource.com/2007/04/02/beaninitializer-wiring-dependencies-in-unit-tests/</link>
	<description>The voice of SpringSource</description>
	<pubDate>Sun, 12 Oct 2008 08:56:21 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2</generator>
		<item>
		<title>By: Rick</title>
		<link>http://blog.springsource.com/2007/04/02/beaninitializer-wiring-dependencies-in-unit-tests/#comment-17359</link>
		<dc:creator>Rick</dc:creator>
		<pubDate>Tue, 03 Apr 2007 12:11:12 +0000</pubDate>
		<guid isPermaLink="false">http://blog.interface21.com/main/2007/04/02/beaninitializer-wiring-dependencies-in-unit-tests/#comment-17359</guid>
		<description>Hi Dave

Good post. I would make the small observation that the BeanInitializer is suited for a specific subset of tests, and typically should not be used for the majority of the unit tests in one's code base (not that I think you were suggesting that, I just want to make that clear).

To my mind, the majority of the *unit* tests in one's code base are still going to use plain old Java constructs (indeed, plain old OO constructs) such as constructors and setters to supply dependencies, mock or otherwise, to the unit under test (rather fortuitously, I &lt;a href="http://plainvanilla.typepad.com/spring/2007/03/writing_in_a_re.html" rel="nofollow"&gt;recently blogged about just this topic&lt;/a&gt;). There is no need to involve Spring at this point, because the majority of the classes in a well structured (Di-based) enterprise application are going to have no Spring dependencies at all. Where the BeanInitializer class, and the other support classes in the Spring mock library, provide tangible value is in the realm of *integration* tests; here the Spring support classes, such as the AbstractDependencyInjectionSpringContextTests class, allow one to use Spring to test (well, obviously I guess) the wiring up of all the various interdependent classes in the integration test in a very convenient fashion (and of course the logic too!). The BeanInitializer also has it's place in integration tests for those special cases where one needs to plug in a non-standard implementation of a collaborator to simulate a failure scenario.

The BeanInitializer does have it's place in a small subset of unit tests, specifically those where you absolutely would benefit from using it :) (haha), or are tied to the framework anyway because one is testing a FactoryBean (for example).

Cheers
Rick</description>
		<content:encoded><![CDATA[<p>Hi Dave</p>
<p>Good post. I would make the small observation that the BeanInitializer is suited for a specific subset of tests, and typically should not be used for the majority of the unit tests in one&#039;s code base (not that I think you were suggesting that, I just want to make that clear).</p>
<p>To my mind, the majority of the *unit* tests in one&#039;s code base are still going to use plain old Java constructs (indeed, plain old OO constructs) such as constructors and setters to supply dependencies, mock or otherwise, to the unit under test (rather fortuitously, I <a href="http://plainvanilla.typepad.com/spring/2007/03/writing_in_a_re.html" rel="nofollow">recently blogged about just this topic</a>). There is no need to involve Spring at this point, because the majority of the classes in a well structured (Di-based) enterprise application are going to have no Spring dependencies at all. Where the BeanInitializer class, and the other support classes in the Spring mock library, provide tangible value is in the realm of *integration* tests; here the Spring support classes, such as the AbstractDependencyInjectionSpringContextTests class, allow one to use Spring to test (well, obviously I guess) the wiring up of all the various interdependent classes in the integration test in a very convenient fashion (and of course the logic too!). The BeanInitializer also has it&#039;s place in integration tests for those special cases where one needs to plug in a non-standard implementation of a collaborator to simulate a failure scenario.</p>
<p>The BeanInitializer does have it&#039;s place in a small subset of unit tests, specifically those where you absolutely would benefit from using it <img src='http://blog.springsource.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> (haha), or are tied to the framework anyway because one is testing a FactoryBean (for example).</p>
<p>Cheers<br />
Rick</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave Syer</title>
		<link>http://blog.springsource.com/2007/04/02/beaninitializer-wiring-dependencies-in-unit-tests/#comment-17333</link>
		<dc:creator>Dave Syer</dc:creator>
		<pubDate>Tue, 03 Apr 2007 07:04:34 +0000</pubDate>
		<guid isPermaLink="false">http://blog.interface21.com/main/2007/04/02/beaninitializer-wiring-dependencies-in-unit-tests/#comment-17333</guid>
		<description>Hmm.  I uploaded a file, but it doesn't show on the main blog page.  I'll look into it.  Meanwhile you can get the same file from here: http://static.springframework.org/downloads/bean-initializer.zip</description>
		<content:encoded><![CDATA[<p>Hmm.  I uploaded a file, but it doesn&#039;t show on the main blog page.  I&#039;ll look into it.  Meanwhile you can get the same file from here: <a href="http://static.springframework.org/downloads/bean-initializer.zip" rel="nofollow">http://static.springframework.org/downloads/bean-initializer.zip</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Debasish Ghosh</title>
		<link>http://blog.springsource.com/2007/04/02/beaninitializer-wiring-dependencies-in-unit-tests/#comment-17325</link>
		<dc:creator>Debasish Ghosh</dc:creator>
		<pubDate>Tue, 03 Apr 2007 04:43:59 +0000</pubDate>
		<guid isPermaLink="false">http://blog.interface21.com/main/2007/04/02/beaninitializer-wiring-dependencies-in-unit-tests/#comment-17325</guid>
		<description>Can't find the uploaded code link .. :-(</description>
		<content:encoded><![CDATA[<p>Can&#039;t find the uploaded code link .. <img src='http://blog.springsource.com/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
</channel>
</rss>
