<?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>bemoko&#039;s blog on mobile &#187; java</title>
	<atom:link href="http://blog.bemoko.com/category/java/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.bemoko.com</link>
	<description>mobile made simple</description>
	<lastBuildDate>Mon, 06 Feb 2012 10:19:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>GroovyWS, CXF and .NET webservices with an AuthHeader = pain</title>
		<link>http://blog.bemoko.com/2010/08/12/groovyws-cxf-and-net-webservices-with-an-authheader-pain/</link>
		<comments>http://blog.bemoko.com/2010/08/12/groovyws-cxf-and-net-webservices-with-an-authheader-pain/#comments</comments>
		<pubDate>Thu, 12 Aug 2010 15:34:32 +0000</pubDate>
		<dc:creator>Mat Diss</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[mobile]]></category>

		<guid isPermaLink="false">http://blog.bemoko.com/?p=949</guid>
		<description><![CDATA[One of the joys of using the bemokoLive development framework is the ease with which you can integrate with external content services.  I&#8217;ve recently been working on a site which needs consume a .NET generated webservice. For this integration, I decided to use GroovyWS which provides a very nice interface to the world of Apache [...]]]></description>
			<content:encoded><![CDATA[<p>One of the joys of using the bemokoLive development framework is the ease with which you can integrate with external content services.  I&#8217;ve recently been working on a site which needs consume a .NET generated webservice.</p>
<p>For this integration, I decided to use <a href="http://groovy.codehaus.org/GroovyWS">GroovyWS</a> which provides a very nice interface to the world of <a href="http://cxf.apache.org/">Apache CXF</a>.    Setting up the webservice is simplicity itself:</p>
<pre>
<pre>proxy = new WSClient(WSDL URL, this.class.classLoader)
proxy.initialize()
</pre>
</pre>
<p>This was all going well until I tried to use the login webservice call.  The login provides a token which is needed to authenticate all further calls to the webservice.  The XML returned from the webservice is:</p>
<pre>
<pre>HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: <span>length</span>

&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt;
  &lt;soap:Header&gt;
    &lt;AuthHeader xmlns="https://app.restaurantdiary.com/webservices/ReservationService/"&gt;
      &lt;Token&gt;<span>string</span>&lt;/Token&gt;
    &lt;/AuthHeader&gt;
  &lt;/soap:Header&gt;
  &lt;soap:Body&gt;
    &lt;LoginResponse xmlns="https://app.restaurantdiary.com/webservices/ReservationService/" /&gt;
  &lt;/soap:Body&gt;
&lt;/soap:Envelope&gt;
</pre>
</pre>
<p>Notice that the token is returned in the SOAP header, not the SOAP body.  It seems that CXF is geared up for reading the body of the message only, getting to the headers is not simple.  So my problem was being able to get the token and add it to further calls.</p>
<p>I tried many searches of the internet, but it seems that either no one has ever had to do this or they have and didn&#8217;t write about it.  Hopefully the following example will help if you ever need to do this.  The following example is in Groovy.</p>
<p>Before I get to the actual example, let me take a quick diversion, but useful, diversion on logging.</p>
<p>I spent hours trying to see the SOAP request and response that was being sent and received, using network sniffers and the like.  Communicating over SSL also meant I was doomed to failure.  Then I discovered interceptors, notably the LoggingInInterceptor and the LoggingOutInterceptor.  This simple piece of code allowed me to log the incoming and outgoing requests</p>
<pre>proxy.client.getInInterceptors().add(new org.apache.cxf.interceptor.LoggingInInterceptor())</pre>
<pre>proxy.client.getOutInterceptors().add(new org.apache.cxf.interceptor.LoggingOutInterceptor())
</pre>
<p>I still didn&#8217;t have my AuthHeader though.  After a lot of experimenting, I found I could access the headers with this piece of code</p>
<pre>def headerList = proxy.client.getResponseContext().get(Header.HEADER_LIST)</pre>
<p>This was good.  Accessing the auth token was fairly simple after that:</p>
<pre>SoapHeader sh = headerList[0]
 def doc = sh.getObject()
 def list = doc.getElementsByTagName("Token")
 token = list.item(0).getFirstChild().getNodeValue()
 log.debug("Token = " + token)
</pre>
<p>Yay, token now safely stored in my variables&#8230;.  Now to add the token to future headers</p>
<pre>List&lt;Header&gt; headers = new ArrayList&lt;Header&gt;();
SOAPFactory sf = SOAPFactory.newInstance()
def authElement = sf.createElement(new
QName(namespace, "AuthHeader"))
def tokenElement = authElement.addChildElement("Token")
tokenElement.addTextNode(token)
SoapHeader tokenHeader = new SoapHeader(new QName(namespace, "AuthHeader"), authElement);
headers.add(tokenHeader);
proxy.client.getRequestContext().put(Header.HEADER_LIST, headers)
</pre>
<p>This code adds the auth header with the token into the SOAP headers for every future request.</p>
<p>Hopefully if you are trying to use SOAP headers with CXF, this post will save you some time.</p>

<div class="sociable">
<div class="sociable_tagline">
<strong>Share and Enjoy:</strong>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.bemoko.com%2F2010%2F08%2F12%2Fgroovyws-cxf-and-net-webservices-with-an-authheader-pain%2F&amp;title=GroovyWS%2C%20CXF%20and%20.NET%20webservices%20with%20an%20AuthHeader%20%3D%20pain&amp;bodytext=One%20of%20the%20joys%20of%20using%20the%20bemokoLive%20development%20framework%20is%20the%20ease%20with%20which%20you%20can%20integrate%20with%20external%20content%20services.%C2%A0%20I%27ve%20recently%20been%20working%20on%20a%20site%20which%20needs%20consume%20a%20.NET%20generated%20webservice.%0D%0A%0D%0AFor%20this%20integration%2C%20I%20" title="Digg"><img src="http://blog.bemoko.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://sphinn.com/index.php?c=post&amp;m=submit&amp;link=http%3A%2F%2Fblog.bemoko.com%2F2010%2F08%2F12%2Fgroovyws-cxf-and-net-webservices-with-an-authheader-pain%2F" title="Sphinn"><img src="http://blog.bemoko.com/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fblog.bemoko.com%2F2010%2F08%2F12%2Fgroovyws-cxf-and-net-webservices-with-an-authheader-pain%2F&amp;title=GroovyWS%2C%20CXF%20and%20.NET%20webservices%20with%20an%20AuthHeader%20%3D%20pain&amp;notes=One%20of%20the%20joys%20of%20using%20the%20bemokoLive%20development%20framework%20is%20the%20ease%20with%20which%20you%20can%20integrate%20with%20external%20content%20services.%C2%A0%20I%27ve%20recently%20been%20working%20on%20a%20site%20which%20needs%20consume%20a%20.NET%20generated%20webservice.%0D%0A%0D%0AFor%20this%20integration%2C%20I%20" title="del.icio.us"><img src="http://blog.bemoko.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fblog.bemoko.com%2F2010%2F08%2F12%2Fgroovyws-cxf-and-net-webservices-with-an-authheader-pain%2F&amp;t=GroovyWS%2C%20CXF%20and%20.NET%20webservices%20with%20an%20AuthHeader%20%3D%20pain" title="Facebook"><img src="http://blog.bemoko.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fblog.bemoko.com%2F2010%2F08%2F12%2Fgroovyws-cxf-and-net-webservices-with-an-authheader-pain%2F&amp;title=GroovyWS%2C%20CXF%20and%20.NET%20webservices%20with%20an%20AuthHeader%20%3D%20pain" title="Mixx"><img src="http://blog.bemoko.com/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fblog.bemoko.com%2F2010%2F08%2F12%2Fgroovyws-cxf-and-net-webservices-with-an-authheader-pain%2F&amp;title=GroovyWS%2C%20CXF%20and%20.NET%20webservices%20with%20an%20AuthHeader%20%3D%20pain&amp;annotation=One%20of%20the%20joys%20of%20using%20the%20bemokoLive%20development%20framework%20is%20the%20ease%20with%20which%20you%20can%20integrate%20with%20external%20content%20services.%C2%A0%20I%27ve%20recently%20been%20working%20on%20a%20site%20which%20needs%20consume%20a%20.NET%20generated%20webservice.%0D%0A%0D%0AFor%20this%20integration%2C%20I%20" title="Google Bookmarks"><img src="http://blog.bemoko.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.bemoko.com/2010/08/12/groovyws-cxf-and-net-webservices-with-an-authheader-pain/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Quick step-by-step guide : Upgrading Junit 3.x to Junit 4.x</title>
		<link>http://blog.bemoko.com/2009/03/20/quick-step-by-step-guide-upgrading-junit-3x-to-junit-4x/</link>
		<comments>http://blog.bemoko.com/2009/03/20/quick-step-by-step-guide-upgrading-junit-3x-to-junit-4x/#comments</comments>
		<pubDate>Fri, 20 Mar 2009 10:45:41 +0000</pubDate>
		<dc:creator>Ian Homer</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[junit]]></category>
		<category><![CDATA[junit 3]]></category>
		<category><![CDATA[junit4]]></category>
		<category><![CDATA[maven]]></category>
		<category><![CDATA[surefire]]></category>

		<guid isPermaLink="false">http://blog.bemoko.com/?p=347</guid>
		<description><![CDATA[Well we finally got around to upgrade all our unit tests to]]></description>
			<content:encoded><![CDATA[<p>Well we finally got around to upgrade all our unit tests to <a href="http://www.junit.org/>Junit 4</a> so we can start benefit from the <a href="http://www.cavdar.net/2008/07/21/junit-4-in-60-seconds/">new features</a>.  About time really!</p>
<p>We use <a href="http://maven.apache.org/">maven</a> and the <a href="http://maven.apache.org/plugins/maven-surefire-plugin/">maven-surefire-plugin</a> for running our unit tests during our build process.  Let&#8217;s look at the steps I did to get migrate.</p>
<ul>
<li>All our test cases extend from a single abstract test case class called AbstractLiveTestCase that in our  Junit 3 integration extended from junit.framework.TestCase.  For Junit 4, tests are described with annotations so we don&#8217;t need to extend this class anymore &#8211; so I <b><em>(1) removed the &#8220;extends TestCase&#8221;</em></b> from our AbstractLiveTestCase</li>
<li>The Junit 3 TestClass class used to provide all the handy assert functions.  These are now provided as org.junit.Assert static methods so I went through each of our tests and <b><em>(2) added &#8220;import static org.junit.Assert.*;&#8221;</em></b>  to the top of each class.  With the handing auto source code formatting in Eclipse enabled, Eclipse automatically expanded the &#8220;org.junit.Assert.*&#8221; imports to the explicit ones needed for that class when I saved it.</li>
<li>And finally <b><em>(3) Added @Test</em></b> to each test method so that Junit would know what tests to run.</li>
</ul>
<p>Basically that was it &#8211; surefire/maven/junit picked up the test cases in the new style &#8211; and in most cases that&#8217;s job done.  However we wanted to go a little further.</p>
<p>We had also implemented in Junit 3 a handy feature that outputted a quick ERROR message in the system out of a test run so we could quickly see the failure.  By default maven&#8217;s surefire simply tells you there was a failure, but you have to look at a file to see what it was. Bit of pain that, so in our Junit 3 extension we would provide more info on the screen when a failure occurred, for example we might see something like:</p>
<p><em>Running com.bemoko.live.platform.mwc.sites.LiveSiteTestCase<br />
     ERROR : *** Test Failure *** Site home not correct expected:</tmp/test[XXX]> but was:</tmp/test[]> @ line 17 of com.bemoko.live.platform.mwc.sites.LiveSiteTestCase (com.bemoko.live.platform.BemokoTestListener)<br />
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.01 sec <<< FAILURE!</em></p>
<p>In Junit 3 we did this by overriding the runTest method of the TestCase class.  In Junit 4 we can use runners and listeners.  To start with we set the @RunWith  annotation on our AbstractLiveTestCase to indicate that all of our tests should run with a specified runner &#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">@RunWith<span style="color: #009900;">&#40;</span>BemokoTestRunner.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">abstract</span> <span style="color: #000000; font-weight: bold;">class</span> AbstractLiveTestCase <span style="color: #009900;">&#123;</span></pre></div></div>

<p>The runner was defined to register a listener &#8230;</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> BemokoTestRunner <span style="color: #000000; font-weight: bold;">extends</span> BlockJUnit4ClassRunner <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">public</span> BemokoTestRunner<span style="color: #009900;">&#40;</span>Class<span style="color: #339933;">&lt;?&gt;</span> clazz<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> InitializationError <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">super</span><span style="color: #009900;">&#40;</span>clazz<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	@Override
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> run<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">final</span> RunNotifier notifier<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		notifier.<span style="color: #006633;">addListener</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> BemokoTestListener<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">super</span>.<span style="color: #006633;">run</span><span style="color: #009900;">&#40;</span>notifier<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>and the listener was defined to listen for failures &#8230;</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> BemokoTestListener <span style="color: #000000; font-weight: bold;">extends</span> RunListener <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> Log log <span style="color: #339933;">=</span> LogFactory.<span style="color: #006633;">getLog</span><span style="color: #009900;">&#40;</span>BemokoTestListener.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	@Override
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> testFailure<span style="color: #009900;">&#40;</span>Failure failure<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #003399;">Throwable</span> t <span style="color: #339933;">=</span> failure.<span style="color: #006633;">getException</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>t <span style="color: #000000; font-weight: bold;">instanceof</span> <span style="color: #003399;">Exception</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			log.<span style="color: #006633;">error</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;*** Test Failure *** &quot;</span> <span style="color: #339933;">+</span> t.<span style="color: #006633;">getMessage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, t<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>t.<span style="color: #006633;">getMessage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				log.<span style="color: #006633;">error</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;*** Test Failure *** &quot;</span> <span style="color: #339933;">+</span> t.<span style="color: #006633;">getMessage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot; @ &quot;</span>
						<span style="color: #339933;">+</span> getErrorLocation<span style="color: #009900;">&#40;</span>t.<span style="color: #006633;">getStackTrace</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
				log.<span style="color: #006633;">error</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;*** Test Failure *** &quot;</span>, t<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
	@Override
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> testIgnored<span style="color: #009900;">&#40;</span>Description description<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>log.<span style="color: #006633;">isWarnEnabled</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			log.<span style="color: #006633;">warn</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;+++ Test ignored +++ &quot;</span> <span style="color: #339933;">+</span> description.<span style="color: #006633;">getDisplayName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">String</span> getErrorLocation<span style="color: #009900;">&#40;</span>StackTraceElement<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> st<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>StackTraceElement ste <span style="color: #339933;">:</span> st<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>ste.<span style="color: #006633;">getClassName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">startsWith</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;com.bemoko&quot;</span><span style="color: #009900;">&#41;</span>
			    <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span>ste.<span style="color: #006633;">getClassName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">contains</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;AbstractLiveTestCase&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			  <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #0000ff;">&quot;line &quot;</span> <span style="color: #339933;">+</span> ste.<span style="color: #006633;">getLineNumber</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot; of &quot;</span> <span style="color: #339933;">+</span> ste.<span style="color: #006633;">getClassName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #0000ff;">&quot;(line number and class not known)&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>in this way I can handle events from my tests in any way I see fit and much more elegant that the Junit 3 implementation I previously had.</p>
<p>Job done and we&#8217;re all sorted for our unit test framework for the foreseeable future.</p>

<div class="sociable">
<div class="sociable_tagline">
<strong>Share and Enjoy:</strong>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.bemoko.com%2F2009%2F03%2F20%2Fquick-step-by-step-guide-upgrading-junit-3x-to-junit-4x%2F&amp;title=Quick%20step-by-step%20guide%20%3A%20Upgrading%20Junit%203.x%20to%20Junit%204.x&amp;bodytext=Well%20we%20finally%20got%20around%20to%20upgrade%20all%20our%20unit%20tests%20to%20" title="Digg"><img src="http://blog.bemoko.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://sphinn.com/index.php?c=post&amp;m=submit&amp;link=http%3A%2F%2Fblog.bemoko.com%2F2009%2F03%2F20%2Fquick-step-by-step-guide-upgrading-junit-3x-to-junit-4x%2F" title="Sphinn"><img src="http://blog.bemoko.com/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fblog.bemoko.com%2F2009%2F03%2F20%2Fquick-step-by-step-guide-upgrading-junit-3x-to-junit-4x%2F&amp;title=Quick%20step-by-step%20guide%20%3A%20Upgrading%20Junit%203.x%20to%20Junit%204.x&amp;notes=Well%20we%20finally%20got%20around%20to%20upgrade%20all%20our%20unit%20tests%20to%20" title="del.icio.us"><img src="http://blog.bemoko.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fblog.bemoko.com%2F2009%2F03%2F20%2Fquick-step-by-step-guide-upgrading-junit-3x-to-junit-4x%2F&amp;t=Quick%20step-by-step%20guide%20%3A%20Upgrading%20Junit%203.x%20to%20Junit%204.x" title="Facebook"><img src="http://blog.bemoko.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fblog.bemoko.com%2F2009%2F03%2F20%2Fquick-step-by-step-guide-upgrading-junit-3x-to-junit-4x%2F&amp;title=Quick%20step-by-step%20guide%20%3A%20Upgrading%20Junit%203.x%20to%20Junit%204.x" title="Mixx"><img src="http://blog.bemoko.com/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fblog.bemoko.com%2F2009%2F03%2F20%2Fquick-step-by-step-guide-upgrading-junit-3x-to-junit-4x%2F&amp;title=Quick%20step-by-step%20guide%20%3A%20Upgrading%20Junit%203.x%20to%20Junit%204.x&amp;annotation=Well%20we%20finally%20got%20around%20to%20upgrade%20all%20our%20unit%20tests%20to%20" title="Google Bookmarks"><img src="http://blog.bemoko.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.bemoko.com/2009/03/20/quick-step-by-step-guide-upgrading-junit-3x-to-junit-4x/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

