<?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: How to customize your jUnit Behavior and Interaction</title>
	<atom:link href="http://www.beilers.com/2009/05/how-to-customize-your-junit-behavior-and-interaction/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.beilers.com/2009/05/how-to-customize-your-junit-behavior-and-interaction/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-customize-your-junit-behavior-and-interaction</link>
	<description>Crazy Thoughts on Software Development and Life in General</description>
	<lastBuildDate>Sat, 07 Jan 2012 03:56:19 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Sam Brannen</title>
		<link>http://www.beilers.com/2009/05/how-to-customize-your-junit-behavior-and-interaction/#comment-31</link>
		<dc:creator>Sam Brannen</dc:creator>
		<pubDate>Wed, 20 May 2009 20:37:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.beilers.com/?p=387#comment-31</guid>
		<description>Hi Phil,

First and foremost, I&#039;m glad to see you&#039;re finding ways to extend the Spring TestContext Framework for your own custom needs!

Secondly, you can simplify your solution:

1) Create your own TestExecutionListener (TEL) which extends AbstractTestExecutionListener and overrides prepareTestInstance().

2) Your custom TEL can access the annotations present on the test class via testContext.getTestClass() (i.e., the code in your AuthorizedSpringjUnit4ClassRunner should logically be in your custom TEL). Note that the TestContext is passed to each method of a TEL.

3) Configure your test class with both your custom TEL and DependencyInjectionTestExecutionListener (DITEL), but make sure to include your custom TEL before DITEL in @TestExecutionListeners.

In other words, there is no need to extend DependencyInjectionTestExecutionListener. Similarly, there is rarely a need to extend SpringJUnit4ClassRunner, since the TestExecutionListener infrastructure generally provides all the hooks you need.

Hope this helps.

Regards,

Sam</description>
		<content:encoded><![CDATA[<p>Hi Phil,</p>
<p>First and foremost, I&#8217;m glad to see you&#8217;re finding ways to extend the Spring TestContext Framework for your own custom needs!</p>
<p>Secondly, you can simplify your solution:</p>
<p>1) Create your own TestExecutionListener (TEL) which extends AbstractTestExecutionListener and overrides prepareTestInstance().</p>
<p>2) Your custom TEL can access the annotations present on the test class via testContext.getTestClass() (i.e., the code in your AuthorizedSpringjUnit4ClassRunner should logically be in your custom TEL). Note that the TestContext is passed to each method of a TEL.</p>
<p>3) Configure your test class with both your custom TEL and DependencyInjectionTestExecutionListener (DITEL), but make sure to include your custom TEL before DITEL in @TestExecutionListeners.</p>
<p>In other words, there is no need to extend DependencyInjectionTestExecutionListener. Similarly, there is rarely a need to extend SpringJUnit4ClassRunner, since the TestExecutionListener infrastructure generally provides all the hooks you need.</p>
<p>Hope this helps.</p>
<p>Regards,</p>
<p>Sam</p>
]]></content:encoded>
	</item>
</channel>
</rss>

