<?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>Transient Technology &#187; java</title>
	<atom:link href="http://martinaharris.com/tag/java/feed/" rel="self" type="application/rss+xml" />
	<link>http://martinaharris.com</link>
	<description>Next time you look it might be gone</description>
	<lastBuildDate>Tue, 24 Jan 2012 18:14:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Update on building .NET</title>
		<link>http://martinaharris.com/2011/10/update-on-building-net/</link>
		<comments>http://martinaharris.com/2011/10/update-on-building-net/#comments</comments>
		<pubDate>Mon, 17 Oct 2011 20:34:31 +0000</pubDate>
		<dc:creator>Martin Harris</dc:creator>
				<category><![CDATA[general]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[build]]></category>
		<category><![CDATA[dependency]]></category>
		<category><![CDATA[dll]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[maven]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[silverlite]]></category>
		<category><![CDATA[sonar]]></category>

		<guid isPermaLink="false">http://martinaharris.com/?p=1085</guid>
		<description><![CDATA[Sometime back now I posted an article on building .NET and dependency management. I have come to learn that there are several ways. Here are my favorites. Build your own maven plugin to build .NET projects. Package 3rd party products &#8230; <a href="http://martinaharris.com/2011/10/update-on-building-net/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Sometime back now I posted an article on <a title="Building software with .NET dependencies in 2010" href="http://martinaharris.com/2010/06/building-software-with-net-dependencies-in-2010/" target="_blank">building .NET and dependency management</a>.</p>
<p>I have come to learn that there are several ways. Here are my favorites.</p>
<ol>
<li>Build your own <a href="http://maven.apache.org/guides/introduction/introduction-to-plugins.html" target="_blank">maven plugin</a> to build .NET projects. Package 3rd party products as zips and put them in maven. Write a plugin that reads solution and project files and calls MSBuild with the appropriate flags.  <strong>Advantage</strong>, maximum flexibility.  <strong>Disadvantage</strong>, lots of effort.</li>
<li>Use the existing <a href="http://maven-dotnet-plugin.appspot.com/" target="_blank">maven-dotnet-plugin</a>.  <strong>Advantage</strong>, does a lot for you including various types of test and coverage systems, plus it can run <a href="http://www.sonarsource.org/" target="_blank">sonar</a>.  <strong>Disadvantage</strong>, Hard to get it to work on complex silverlight projects. In fact hard full stop.  The docs are not great.</li>
<li>Use <a href="http://nuget.codeplex.com/" target="_blank">NuGet</a>.  <strong>Advantages</strong>, it has .NET pedigree and Microsoft Backing.  Adoption amongst .net developers is probably an easier sell than a java utility.  <strong>Disadvantages</strong>, Very early days for the project, as yet unproven.</li>
<li>Finally <a href="http://npanday.codeplex.com/" target="_blank">npanday</a>.  <strong>Advantages</strong>, nice integration with Visual Studio.  <strong>Disadvantages</strong>, very hard to get it to work with silverlight.  Impossible in fact as MS have kindly removed the command line baml compile utility.</li>
</ol>
<div>So in summary.  There are ways to do this now.  There is hope for .NET dependency management!</div>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fmartinaharris.com%2F2011%2F10%2Fupdate-on-building-net%2F&amp;title=Update+on+building+.NET" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fmartinaharris.com%2F2011%2F10%2Fupdate-on-building-net%2F&amp;title=Update+on+building+.NET" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fmartinaharris.com%2F2011%2F10%2Fupdate-on-building-net%2F&amp;title=Update+on+building+.NET" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fmartinaharris.com%2F2011%2F10%2Fupdate-on-building-net%2F&amp;headline=Update+on+building+.NET" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=Update+on+building+.NET&amp;url=http%3A%2F%2Fmartinaharris.com%2F2011%2F10%2Fupdate-on-building-net%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=Update+on+building+.NET&amp;u=http%3A%2F%2Fmartinaharris.com%2F2011%2F10%2Fupdate-on-building-net%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=Update+on+building+.NET&amp;url=http%3A%2F%2Fmartinaharris.com%2F2011%2F10%2Fupdate-on-building-net%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=Update+on+building+.NET&amp;url=http%3A%2F%2Fmartinaharris.com%2F2011%2F10%2Fupdate-on-building-net%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=Update+on+building+.NET&amp;url=http%3A%2F%2Fmartinaharris.com%2F2011%2F10%2Fupdate-on-building-net%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fmartinaharris.com%2F2011%2F10%2Fupdate-on-building-net%2F&amp;title=Update+on+building+.NET&amp;summary=&amp;source=" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fmartinaharris.com%2F2011%2F10%2Fupdate-on-building-net%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://twitter.com/home?status=Reading+http%3A%2F%2Fmartinaharris.com%2F2011%2F10%2Fupdate-on-building-net%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/buzz/post?url=http%3A%2F%2Fmartinaharris.com%2F2011%2F10%2Fupdate-on-building-net%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div><div class="dzone_button" style="float: right; margin-left: 5px;">
<script type="text/javascript">
var dzone_url = 'http://martinaharris.com/2011/10/update-on-building-net/';
var dzone_title = 'Update on building .NET';
var dzone_blurb = '';
var dzone_style = '2';
</script>
<script language="javascript" src="http://widgets.dzone.com/links/widgets/zoneit.js"></script>
</div>]]></content:encoded>
			<wfw:commentRss>http://martinaharris.com/2011/10/update-on-building-net/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The power of XMLUnit with google Predicate</title>
		<link>http://martinaharris.com/2010/12/the-power-of-xmlunit-with-google-predicate/</link>
		<comments>http://martinaharris.com/2010/12/the-power-of-xmlunit-with-google-predicate/#comments</comments>
		<pubDate>Tue, 14 Dec 2010 22:46:19 +0000</pubDate>
		<dc:creator>Martin Harris</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[collections]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[predicate]]></category>
		<category><![CDATA[XMLUnit]]></category>

		<guid isPermaLink="false">http://martinaharris.com/?p=1069</guid>
		<description><![CDATA[I have been interested in XMLUnit and google collections predicate system for awhile now and recently wrote the following as part of a test.  I have removed some of the test and left just the bits that illustrate this point. The test needs &#8230; <a href="http://martinaharris.com/2010/12/the-power-of-xmlunit-with-google-predicate/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I have been interested in <a title="XMLUnit on sourceforge" href="http://xmlunit.sourceforge.net/" target="_blank">XMLUnit</a> and <a title="Google Collections" href="http://code.google.com/p/google-collections/" target="_blank">google collections</a> predicate system for awhile now and recently wrote the following as part of a test.  I have removed some of the test and left just the bits that illustrate this point.</p>
<p>The test needs to perform a check that the result of transforming some xml is correct.  A reference file is available so we can use XMLUnit to perform a difference.  In my file there is a seconds attribute and because seconds vary with each parse we choose to ignore the value.  There are other ways to achieve this, but its more complex and uses more XMLUnit code. Using a google predicate simplifies this check.</p>
<p>First produce your output file and load the sample and output into strings.  Normally for a test I produce a smaller sample xml file.  Then using XMLUnit difference engine get all differences.</p>
<pre class="brush: java; gutter: false; wrap-lines: false">    Diff d = new Diff(expectedAsString, outputAsString);
    DetailedDiff dd = new DetailedDiff(d);
    List listOfDifferences = dd.getAllDifferences();
</pre>
<p>Next call a function to check that the only differences found are within the seconds attribute.  This uses a predicates from google to perform the matching.</p>
<pre class="brush: java; gutter: false; wrap-lines: false">
    assertTrue(onlyDiffsMatchThisAttributeName("seconds",listOfDifferences));
    }

    private static boolean onlyDiffsMatchThisAttributeName(final String attrName, Iterable it) {

    Iterable filtered = Iterables.filter(it, new Predicate() {

        @Override
        public boolean apply(Difference input) {

                final NodeDetail testNodeDetail = input.getTestNodeDetail();
                if (nodeDetail == null) return false;

                final Node node = nodeDetail.getNode();
                if (node == null) return false;

                final String nodeName = node.getNodeName();
                if (nodeName == null) return false;

                return !nodeName.equals(attrName);
            }
        });
        return (newArrayList(filtered).isEmpty());
    }</pre>
<p>Note that what is happening here is the predicate is filtering away all the seconds matches.  If anything remains in the list false is returned.  Neat huh!  <img src='http://martinaharris.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fmartinaharris.com%2F2010%2F12%2Fthe-power-of-xmlunit-with-google-predicate%2F&amp;title=The+power+of+XMLUnit+with+google+Predicate" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fmartinaharris.com%2F2010%2F12%2Fthe-power-of-xmlunit-with-google-predicate%2F&amp;title=The+power+of+XMLUnit+with+google+Predicate" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fmartinaharris.com%2F2010%2F12%2Fthe-power-of-xmlunit-with-google-predicate%2F&amp;title=The+power+of+XMLUnit+with+google+Predicate" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fmartinaharris.com%2F2010%2F12%2Fthe-power-of-xmlunit-with-google-predicate%2F&amp;headline=The+power+of+XMLUnit+with+google+Predicate" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=The+power+of+XMLUnit+with+google+Predicate&amp;url=http%3A%2F%2Fmartinaharris.com%2F2010%2F12%2Fthe-power-of-xmlunit-with-google-predicate%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=The+power+of+XMLUnit+with+google+Predicate&amp;u=http%3A%2F%2Fmartinaharris.com%2F2010%2F12%2Fthe-power-of-xmlunit-with-google-predicate%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=The+power+of+XMLUnit+with+google+Predicate&amp;url=http%3A%2F%2Fmartinaharris.com%2F2010%2F12%2Fthe-power-of-xmlunit-with-google-predicate%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=The+power+of+XMLUnit+with+google+Predicate&amp;url=http%3A%2F%2Fmartinaharris.com%2F2010%2F12%2Fthe-power-of-xmlunit-with-google-predicate%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=The+power+of+XMLUnit+with+google+Predicate&amp;url=http%3A%2F%2Fmartinaharris.com%2F2010%2F12%2Fthe-power-of-xmlunit-with-google-predicate%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fmartinaharris.com%2F2010%2F12%2Fthe-power-of-xmlunit-with-google-predicate%2F&amp;title=The+power+of+XMLUnit+with+google+Predicate&amp;summary=&amp;source=" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fmartinaharris.com%2F2010%2F12%2Fthe-power-of-xmlunit-with-google-predicate%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://twitter.com/home?status=Reading+http%3A%2F%2Fmartinaharris.com%2F2010%2F12%2Fthe-power-of-xmlunit-with-google-predicate%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/buzz/post?url=http%3A%2F%2Fmartinaharris.com%2F2010%2F12%2Fthe-power-of-xmlunit-with-google-predicate%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div><div class="dzone_button" style="float: right; margin-left: 5px;">
<script type="text/javascript">
var dzone_url = 'http://martinaharris.com/2010/12/the-power-of-xmlunit-with-google-predicate/';
var dzone_title = 'The power of XMLUnit with google Predicate';
var dzone_blurb = '';
var dzone_style = '2';
</script>
<script language="javascript" src="http://widgets.dzone.com/links/widgets/zoneit.js"></script>
</div>]]></content:encoded>
			<wfw:commentRss>http://martinaharris.com/2010/12/the-power-of-xmlunit-with-google-predicate/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The idea of non backward compatible Java?</title>
		<link>http://martinaharris.com/2010/09/the-idea-of-non-backward-compatible-java/</link>
		<comments>http://martinaharris.com/2010/09/the-idea-of-non-backward-compatible-java/#comments</comments>
		<pubDate>Thu, 23 Sep 2010 20:19:42 +0000</pubDate>
		<dc:creator>Martin Harris</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[jvm]]></category>

		<guid isPermaLink="false">http://martinaharris.com/?p=1065</guid>
		<description><![CDATA[I have not been blogging much, but I have been reading. Java is somewhat disappointing of late for various reasons.  Then I stumbled across this: the_next_big_jvm_language1 from Stephen Colebourne.  It seems like an interesting idea to me.  It would take some doing, &#8230; <a href="http://martinaharris.com/2010/09/the-idea-of-non-backward-compatible-java/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I have not been blogging much, but I have been reading. Java is somewhat disappointing of late for various reasons.  Then I stumbled across this: <a title="The next big JVM language" href="http://www.jroller.com/scolebourne/entry/the_next_big_jvm_language1" target="_blank">the_next_big_jvm_language1</a> from Stephen Colebourne.  It seems like an interesting idea to me.  It would take some doing, but the advantages could be huge.  It could encompass some of the best ideas and leave behind some of the old ideas we still struggle to shrug off.</p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fmartinaharris.com%2F2010%2F09%2Fthe-idea-of-non-backward-compatible-java%2F&amp;title=The+idea+of+non+backward+compatible+Java%3F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fmartinaharris.com%2F2010%2F09%2Fthe-idea-of-non-backward-compatible-java%2F&amp;title=The+idea+of+non+backward+compatible+Java%3F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fmartinaharris.com%2F2010%2F09%2Fthe-idea-of-non-backward-compatible-java%2F&amp;title=The+idea+of+non+backward+compatible+Java%3F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fmartinaharris.com%2F2010%2F09%2Fthe-idea-of-non-backward-compatible-java%2F&amp;headline=The+idea+of+non+backward+compatible+Java%3F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=The+idea+of+non+backward+compatible+Java%3F&amp;url=http%3A%2F%2Fmartinaharris.com%2F2010%2F09%2Fthe-idea-of-non-backward-compatible-java%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=The+idea+of+non+backward+compatible+Java%3F&amp;u=http%3A%2F%2Fmartinaharris.com%2F2010%2F09%2Fthe-idea-of-non-backward-compatible-java%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=The+idea+of+non+backward+compatible+Java%3F&amp;url=http%3A%2F%2Fmartinaharris.com%2F2010%2F09%2Fthe-idea-of-non-backward-compatible-java%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=The+idea+of+non+backward+compatible+Java%3F&amp;url=http%3A%2F%2Fmartinaharris.com%2F2010%2F09%2Fthe-idea-of-non-backward-compatible-java%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=The+idea+of+non+backward+compatible+Java%3F&amp;url=http%3A%2F%2Fmartinaharris.com%2F2010%2F09%2Fthe-idea-of-non-backward-compatible-java%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fmartinaharris.com%2F2010%2F09%2Fthe-idea-of-non-backward-compatible-java%2F&amp;title=The+idea+of+non+backward+compatible+Java%3F&amp;summary=&amp;source=" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fmartinaharris.com%2F2010%2F09%2Fthe-idea-of-non-backward-compatible-java%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://twitter.com/home?status=Reading+http%3A%2F%2Fmartinaharris.com%2F2010%2F09%2Fthe-idea-of-non-backward-compatible-java%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/buzz/post?url=http%3A%2F%2Fmartinaharris.com%2F2010%2F09%2Fthe-idea-of-non-backward-compatible-java%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div><div class="dzone_button" style="float: right; margin-left: 5px;">
<script type="text/javascript">
var dzone_url = 'http://martinaharris.com/2010/09/the-idea-of-non-backward-compatible-java/';
var dzone_title = 'The idea of non backward compatible Java?';
var dzone_blurb = '';
var dzone_style = '2';
</script>
<script language="javascript" src="http://widgets.dzone.com/links/widgets/zoneit.js"></script>
</div>]]></content:encoded>
			<wfw:commentRss>http://martinaharris.com/2010/09/the-idea-of-non-backward-compatible-java/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Building software with .NET dependencies in 2010</title>
		<link>http://martinaharris.com/2010/06/building-software-with-net-dependencies-in-2010/</link>
		<comments>http://martinaharris.com/2010/06/building-software-with-net-dependencies-in-2010/#comments</comments>
		<pubDate>Tue, 22 Jun 2010 21:23:56 +0000</pubDate>
		<dc:creator>Martin Harris</dc:creator>
				<category><![CDATA[software development]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[dependency]]></category>
		<category><![CDATA[dll]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[silverlite]]></category>
		<category><![CDATA[wpf]]></category>

		<guid isPermaLink="false">http://martinaharris.com/?p=1047</guid>
		<description><![CDATA[I come from a Java background. So over the last decade I have moved away from managing dependencies on projects using jars in shared folders. Most professional java programmers have used Maven or Ivy. Recently I looked at Groovy and &#8230; <a href="http://martinaharris.com/2010/06/building-software-with-net-dependencies-in-2010/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I come from a Java background.  So over the last decade I have moved away from managing dependencies on projects using jars in shared folders.  Most professional java programmers have used Maven or Ivy.  Recently I looked at Groovy and Gradle.  All well and good.  What do programmers use for .NET, WPF and Silverlite?  I have been trying to find out and there are mixed opinions.  Some write scripts to copy .dll files, others rely on the Visual Studio solutions.  None of these solutions are scalable.  I found this project: <a href="http://npanday.codeplex.com/ " target="_blank">npanday</a> Has anyone used it on a large project?  I would love to hear your views or review.  What does microsoft do?  What do you do?</p>
<p>Please comment here I am very interested in hearing what other programmers do for .NET dependency management.</p>
<h2>Links for the Java world of dependency management</h2>
<p><a href="http://maven.apache.org/" target="_blank">http://maven.apache.org/</a></p>
<p><a href="http://ant.apache.org/ivy/" target="_blank">http://ant.apache.org/ivy/</a></p>
<p><a href="http://www.gradle.org/" target="_blank">http://www.gradle.org/</a></p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fmartinaharris.com%2F2010%2F06%2Fbuilding-software-with-net-dependencies-in-2010%2F&amp;title=Building+software+with+.NET+dependencies+in+2010" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fmartinaharris.com%2F2010%2F06%2Fbuilding-software-with-net-dependencies-in-2010%2F&amp;title=Building+software+with+.NET+dependencies+in+2010" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fmartinaharris.com%2F2010%2F06%2Fbuilding-software-with-net-dependencies-in-2010%2F&amp;title=Building+software+with+.NET+dependencies+in+2010" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fmartinaharris.com%2F2010%2F06%2Fbuilding-software-with-net-dependencies-in-2010%2F&amp;headline=Building+software+with+.NET+dependencies+in+2010" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=Building+software+with+.NET+dependencies+in+2010&amp;url=http%3A%2F%2Fmartinaharris.com%2F2010%2F06%2Fbuilding-software-with-net-dependencies-in-2010%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=Building+software+with+.NET+dependencies+in+2010&amp;u=http%3A%2F%2Fmartinaharris.com%2F2010%2F06%2Fbuilding-software-with-net-dependencies-in-2010%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=Building+software+with+.NET+dependencies+in+2010&amp;url=http%3A%2F%2Fmartinaharris.com%2F2010%2F06%2Fbuilding-software-with-net-dependencies-in-2010%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=Building+software+with+.NET+dependencies+in+2010&amp;url=http%3A%2F%2Fmartinaharris.com%2F2010%2F06%2Fbuilding-software-with-net-dependencies-in-2010%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=Building+software+with+.NET+dependencies+in+2010&amp;url=http%3A%2F%2Fmartinaharris.com%2F2010%2F06%2Fbuilding-software-with-net-dependencies-in-2010%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fmartinaharris.com%2F2010%2F06%2Fbuilding-software-with-net-dependencies-in-2010%2F&amp;title=Building+software+with+.NET+dependencies+in+2010&amp;summary=&amp;source=" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fmartinaharris.com%2F2010%2F06%2Fbuilding-software-with-net-dependencies-in-2010%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://twitter.com/home?status=Reading+http%3A%2F%2Fmartinaharris.com%2F2010%2F06%2Fbuilding-software-with-net-dependencies-in-2010%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/buzz/post?url=http%3A%2F%2Fmartinaharris.com%2F2010%2F06%2Fbuilding-software-with-net-dependencies-in-2010%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div><div class="dzone_button" style="float: right; margin-left: 5px;">
<script type="text/javascript">
var dzone_url = 'http://martinaharris.com/2010/06/building-software-with-net-dependencies-in-2010/';
var dzone_title = 'Building software with .NET dependencies in 2010';
var dzone_blurb = '';
var dzone_style = '2';
</script>
<script language="javascript" src="http://widgets.dzone.com/links/widgets/zoneit.js"></script>
</div>]]></content:encoded>
			<wfw:commentRss>http://martinaharris.com/2010/06/building-software-with-net-dependencies-in-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tumble dried BDD from Studio Pragmatists</title>
		<link>http://martinaharris.com/2010/05/tumble-dried-bdd/</link>
		<comments>http://martinaharris.com/2010/05/tumble-dried-bdd/#comments</comments>
		<pubDate>Fri, 21 May 2010 22:02:32 +0000</pubDate>
		<dc:creator>Martin Harris</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[scrum and agile]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[agile]]></category>
		<category><![CDATA[annotation]]></category>
		<category><![CDATA[BDD]]></category>
		<category><![CDATA[behavior]]></category>
		<category><![CDATA[collaboration]]></category>
		<category><![CDATA[junit]]></category>
		<category><![CDATA[product-owner]]></category>
		<category><![CDATA[scrum]]></category>
		<category><![CDATA[spring]]></category>
		<category><![CDATA[teams]]></category>
		<category><![CDATA[test-specialist]]></category>

		<guid isPermaLink="false">http://martinaharris.com/?p=1027</guid>
		<description><![CDATA[On the 18th of May, 2010, the very new tumbler-glass project by Studio Pragmatists uploaded Tumbler 0.2.1 to Maven.  Having recently written about JBehave I found myself really liking the concept of behavior driven development.  So I decided to write &#8230; <a href="http://martinaharris.com/2010/05/tumble-dried-bdd/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>On the 18th of May, 2010, the very new tumbler-glass project by <a title="Studio Pragmatists Blog" href="http://studiopragmatists.blogspot.com/" target="_blank">Studio Pragmatists</a> uploaded Tumbler 0.2.1 to Maven.  Having recently written about <a title="JBehave article" href="/2010/05/bad-or-good-bdd-within-scrum/" target="_blank">JBehave</a> I found myself really liking the concept of behavior driven development.  So I decided to write a similar article about Tumbler.  If you want the project code its available in my <a title="Testing Project" href="http://github.com/mhgit/TerribleJavaTestingMadeGood" target="_blank">example project</a>.</p>
<h2>4 hour time box in 20 minutes!</h2>
<p>Once again I decided to time box the work to 4 hours.  This time though the whole process only took about 20 minutes.  The product owner and testers produce a story file.  The Tumbler format allows for multiple stories each containing scenarios, so its possible to cover a complex set of requirements in one file.  This allows for flexibility when breaking down the work into tasks.  As per the usual behavior driven approach, a scenario contains the <strong>Given</strong>, <strong>When</strong> and <strong>Then</strong> sections which describe the behavior.<span id="more-1027"></span></p>
<h3>A simple tumbler behavior file</h3>
<pre>Story: Building a simple page

Scenario: should create a page 4 lines long with 5 data items in each line
Given a data fixture capable of complex page checking
When a page is created with 'twenty' items on a page
Then there should be 'four' lines on a page with 'five' data items on each line</pre>
<h2>Generating the Java files</h2>
<p>The next step is to generate java from the scenario files I used an eclipse run configuration but the command line is:</p>
<pre>java -classpath Tumbler.jar tumbler.ScenarioToJavaConverter YOUR_STORY.scenario</pre>
<p>For the above scenario this was the result.  Note the generation of given, when and then methods and @story, @Scenario annotations that match up with the original file.</p>
<pre class="brush: java; gutter: false; wrap-lines: false">import org.junit.*;
import static org.junit.Assert.*;
import static tumbler.Tumbler.*;

@RunWith(TumblerRunner.class)
@Story("Building a simple page")
public class BuildingASimplePageScenarios {

        @Scenario(pending = true)
        public void shouldCreateAPage4LinesLongWith5DataItemsInEachLine() {
                given("a data fixture capable of complex page checking");

                when("a page is created with 'twenty' items on a page");

                then("there should be 'four' lines on a page with 'five' data items on each line");
        }
}</pre>
<h3>Which just leaves filling in the behavior and the actual test</h3>
<pre class="brush: java; gutter: false; wrap-lines: false">@RunWith(TumblerRunner.class)
@Story("Building a simple page")
public class BuildingASimplePageScenarios {
	private SimplePage page;

	@Scenario(pending = false)
	public void shouldCreateAPage4LinesLongWith5DataItemsInEachLine() {
		given("a data fixture capable of complex page checking");
		final PageDataFixture dataFixture = new PageDataFixture();

		when("a page is created with 'twenty' items on a page");
		page = SimplePage.newInstance(dataFixture.getDataItem(), 20);

		then("there should be 'four' lines on a page with 'five' data items on each line");
		Map expectedLines = dataFixture.createPageExpectation(4, 5);

		Map actualMap = page.getMap();

		assertThat(actualMap, is(expectedLines));
       }
}</pre>
<p>Finally there are two flags that can be applied to the test runner which turn on the production of a report. (-DgenerateReport=html -DoutputFolder=target)  It would be easy to configure a maven profile that picked up all your scenario files, and passed in these two flags.  The standard report uses Freemarker so it would be easy to produce your own.  Its a simple list of scenarios and their detail.</p>
<h3>This is what my report looked like</h3>
<div id="attachment_1038" class="wp-caption alignnone" style="width: 160px"><a href="http://martinaharris.com/wp-content/uploads/2010/05/tumblerReport.jpg"><img class="size-thumbnail wp-image-1038" title="tumblerReport" src="http://martinaharris.com/wp-content/uploads/2010/05/tumblerReport-150x150.jpg" alt="Tumbler Report" width="150" height="150" /></a><p class="wp-caption-text">Tumbler Report - Scenario Detail Page</p></div>
<h2>Good Points</h2>
<ul>
<li>As per JBehave I like the attempt to draw the product owner closer to the testing and development team members.</li>
<li>Its a very simple system with very small learning curve</li>
<li>Generating the Java improves productivity and allows the product owner to work on separate artifacts</li>
</ul>
<h2>Bad Points</h2>
<ul>
<li>Currently its a very early beta release.  Not so much a criticism as a reminder that things might evolve in a breaking fashion at this stage.</li>
<li>I would like to see the ability to generate parameters out of the scenario files.  If not, then a way to edit the tests to introduce parameter driven testing.</li>
<li>Scrum and agile are iterative.  Adding to the original scenario files would mean generating the classes again.  This leaves the developer with the unpleasant task of transferring over changes. This might be solved if the inputs were the scenario file, and the finished test Java, with output that modifies and adds.  Running them would show the breaks if the parameters were also part of the generation.</li>
</ul>
<h2>Conclusion</h2>
<p>I can&#8217;t wait to see a full version, or at least a release candidate version because I can see a future for this project.</p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fmartinaharris.com%2F2010%2F05%2Ftumble-dried-bdd%2F&amp;title=Tumble+dried+BDD+from+Studio+Pragmatists" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fmartinaharris.com%2F2010%2F05%2Ftumble-dried-bdd%2F&amp;title=Tumble+dried+BDD+from+Studio+Pragmatists" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fmartinaharris.com%2F2010%2F05%2Ftumble-dried-bdd%2F&amp;title=Tumble+dried+BDD+from+Studio+Pragmatists" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fmartinaharris.com%2F2010%2F05%2Ftumble-dried-bdd%2F&amp;headline=Tumble+dried+BDD+from+Studio+Pragmatists" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=Tumble+dried+BDD+from+Studio+Pragmatists&amp;url=http%3A%2F%2Fmartinaharris.com%2F2010%2F05%2Ftumble-dried-bdd%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=Tumble+dried+BDD+from+Studio+Pragmatists&amp;u=http%3A%2F%2Fmartinaharris.com%2F2010%2F05%2Ftumble-dried-bdd%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=Tumble+dried+BDD+from+Studio+Pragmatists&amp;url=http%3A%2F%2Fmartinaharris.com%2F2010%2F05%2Ftumble-dried-bdd%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=Tumble+dried+BDD+from+Studio+Pragmatists&amp;url=http%3A%2F%2Fmartinaharris.com%2F2010%2F05%2Ftumble-dried-bdd%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=Tumble+dried+BDD+from+Studio+Pragmatists&amp;url=http%3A%2F%2Fmartinaharris.com%2F2010%2F05%2Ftumble-dried-bdd%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fmartinaharris.com%2F2010%2F05%2Ftumble-dried-bdd%2F&amp;title=Tumble+dried+BDD+from+Studio+Pragmatists&amp;summary=&amp;source=" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fmartinaharris.com%2F2010%2F05%2Ftumble-dried-bdd%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://twitter.com/home?status=Reading+http%3A%2F%2Fmartinaharris.com%2F2010%2F05%2Ftumble-dried-bdd%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/buzz/post?url=http%3A%2F%2Fmartinaharris.com%2F2010%2F05%2Ftumble-dried-bdd%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div><div class="dzone_button" style="float: right; margin-left: 5px;">
<script type="text/javascript">
var dzone_url = 'http://martinaharris.com/2010/05/tumble-dried-bdd/';
var dzone_title = 'Tumble dried BDD from Studio Pragmatists';
var dzone_blurb = '';
var dzone_style = '2';
</script>
<script language="javascript" src="http://widgets.dzone.com/links/widgets/zoneit.js"></script>
</div>]]></content:encoded>
			<wfw:commentRss>http://martinaharris.com/2010/05/tumble-dried-bdd/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Bad or Good? Behavior Driven Development within Scrum.</title>
		<link>http://martinaharris.com/2010/05/bad-or-good-bdd-within-scrum/</link>
		<comments>http://martinaharris.com/2010/05/bad-or-good-bdd-within-scrum/#comments</comments>
		<pubDate>Mon, 17 May 2010 17:46:35 +0000</pubDate>
		<dc:creator>Martin Harris</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[scrum and agile]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[agile]]></category>
		<category><![CDATA[annotation]]></category>
		<category><![CDATA[BDD]]></category>
		<category><![CDATA[behavior]]></category>
		<category><![CDATA[collaboration]]></category>
		<category><![CDATA[junit]]></category>
		<category><![CDATA[product-owner]]></category>
		<category><![CDATA[scrum]]></category>
		<category><![CDATA[spring]]></category>
		<category><![CDATA[teams]]></category>
		<category><![CDATA[test-specialist]]></category>

		<guid isPermaLink="false">http://martinaharris.com/?p=1001</guid>
		<description><![CDATA[I wanted to explore the possibility of using JBehave to formalise scrums definition of done. The idea being to encapsulate a definition of done as a JBehave scenario. So in true scrum style I decided to timebox 4 hours of &#8230; <a href="http://martinaharris.com/2010/05/bad-or-good-bdd-within-scrum/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I wanted to explore the possibility of using <a title="JBehave about" href="http://jbehave.org/reference/stable/index.html" target="_blank">JBehave</a> to formalise scrums definition of done.  The idea being to encapsulate a definition of done as a JBehave scenario.  So in true scrum style I decided to timebox 4 hours of work dedicated to JBehave.</p>
<p>From a scrum point of view BDD can be used to turn the definition of done into a test artifact. The team produces scenarios for each task.  With JBehave a scenario file describes the required behavior and test steps it will need to pass to be considered done.  I.e Given some prerequisites, perform some action and expect some results.  See the JBehave project for more detail as this is only a simple example.<span id="more-1001"></span></p>
<h2>BDD in 4 hours?</h2>
<p>So scenarios are just text files describing the required functionality in terms of expected behavior.  Even before development though, its possible to run them and see the pending expectations.  Lets wizz though a simple example showing who in a scrum team is responsible for what.  I already have a project that I use to <a title="Testing Project" href="http://github.com/mhgit/TerribleJavaTestingMadeGood" target="_blank">explore test patterns</a> so I thought I would just introduce it to that.  If you want the working version just take a fork from github.</p>
<p>Nb. I have a data fixture used in testing a complex page component.  So whilst not a pure scenario I can make its existence part of the Givens.  In this project, its likely that no real given is required, but a developer would add it during the build.</p>
<p><strong>First</strong> the product owner and tester produce a simple scenario file describing behavior and expectations.</p>
<pre>Given a data fixture
When a page is created with 20 items on a page
Then expected lines on a page is 4 with data items in a line 5</pre>
<p><strong>Next</strong> developers write a harness and flesh out the steps required to meet the behaviour.</p>
<p>We need to bootstrap the scenario and add steps to it.  The general idea is to have a scenario test, that then includes the steps.  This is one way of bootstrapping in the steps, other ways are available including a spring system that uses <a title="SpringStepsFactory API" href="http://jbehave.org/reference/stable/javadoc/spring/org/jbehave/scenario/steps/spring/SpringStepsFactory.html" target="_blank">SpringStepsFactory</a>.  I ran into problems with the spring system as my project uses spring 3 and JBehave is still locked into spring 2.5.6.  In addition I am using junit 4.8 and spring 2.5.6 requires 4.4.  This is ultimately an issue as on many projects.  I would not want to tie in those older versions.  In fact other ideas in my project prevent me from doing this too.  So in my timebox I avoid the issue and bootstrap manually.</p>
<h2>The Bootstrap test class</h2>
<pre class="brush: java; gutter: false; wrap-lines: false">public class SimplePageScenario extends JUnitScenario {
	public SimplePageScenario() {
		super(new MostUsefulConfiguration() {
			@Override
			public ScenarioDefiner forDefiningScenarios() {
				return new ClasspathScenarioDefiner(
						new UnderscoredCamelCaseResolver(".scn"),
						new PatternScenarioParser());
                        }
                });

		addSteps(new SimplePageSteps());
        }
}</pre>
<p>Before adding the call to addSteps()) running the scenario shows the steps that are pending.</p>
<pre>(org/testpatterns/scenarios/example_scenario.scn)
Scenario:
Given a spring data fixture (PENDING)
When a page is created with 20 items on a page (PENDING)
Then expected lines on a page is 4 with data items in a line 5 (PENDING)</pre>
<p><strong>Finally</strong> the developers fill in the Steps class adding sections that match against the scenario keywords, Given, When and Then.  Development is done until the behavior passes the test.</p>
<pre class="brush: java; gutter: false; wrap-lines: false">public class SimplePageSteps extends Steps {

	private SimplePage page;

	private final PageDataFixture dataFixture = new PageDataFixture();

	@Given("a data fixture")
	public void givenASpringDataFixture() {
		notNull(dataFixture);
	}

	@When("a page is created with $itemsOnAPage items on a page")
	public void createPage(int itemsOnAPage) {
		page = SimplePage.newInstance(dataFixture.getDataItem(), itemsOnAPage);
	}

	@Then("expected lines on a page is $linesOnAPage with data items in a line $itemsInALine")
	public void validatePage(int linesOnAPage, int itemsInALine) {
		Map expectedLines = dataFixture.createPageExpectation(linesOnAPage, itemsInALine);

		Map actualMap = page.getMap();

		ensureThat(actualMap, is(expectedLines));
	}

}</pre>
<h2>Good Points</h2>
<ul>
<li> I like the potential to get key scrum members interacting.  The collaboration between the testers and product owner is an important one as it should flesh out questions about behaviour at an early stage.  Similar benefits occur when the development team starts to get to grip with the behavior.</li>
<li> Having a simple scenario artifact means the product owner can get involved with something that actually becomes part of the continuous integration.</li>
</ul>
<h2>Bad Points</h2>
<ul>
<li>The bootstrap is clumsy.  Having to add steps means that after producing the new scenarios development have to get involved before the pending steps appear.  There are other ways to bootstrap.  The spring system is a step in the right direction, in fact I would like to use injection throughout the application.  This still does not solve the problem of having to edit something before the steps appear.  I would prefer that once the scenario is in place, steps are automatically found as they are written, and appear as not started until they are cut.</li>
<li> Extending Junit Testcase is also a problem.  Its highly likely that in more complex projects we would need mocking techniques or spring based tests.  These have their own runners brought in with the @RunWith annotation.  It would be better if there were some way to bootstrap the behaviour into any other test framework.</li>
<li> In my 4 hour timebox I did not get the reporting working.  Unfortunately the reporting requires more coding, and setup and is far from being just a bit of maven configuration.</li>
<li> When running from maven things did not work until I configured the maven-resource-plugin to copy over the scenario files.  This should have just worked out of the box.</li>
<li>Most of my 4 hours was taken up with configuration which was compounded by the slim documentation.</li>
</ul>
<h2>Conclusion</h2>
<p>Attempting a behavior driven approach using scenarios is worth doing.  I could see the benefits.  Not sure if JBehave is the solution for me though.  Difficult to configure, and incompatibilities with other frameworks would put me off at the moment.  I will find some time to have a look at <a title="Easyb" href="http://www.easyb.org/" target="_blank">easyb</a> another java BDD system next.</p>
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 823px; width: 1px; height: 1px;"></div>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fmartinaharris.com%2F2010%2F05%2Fbad-or-good-bdd-within-scrum%2F&amp;title=Bad+or+Good%3F+Behavior+Driven+Development+within+Scrum." target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fmartinaharris.com%2F2010%2F05%2Fbad-or-good-bdd-within-scrum%2F&amp;title=Bad+or+Good%3F+Behavior+Driven+Development+within+Scrum." target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fmartinaharris.com%2F2010%2F05%2Fbad-or-good-bdd-within-scrum%2F&amp;title=Bad+or+Good%3F+Behavior+Driven+Development+within+Scrum." target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fmartinaharris.com%2F2010%2F05%2Fbad-or-good-bdd-within-scrum%2F&amp;headline=Bad+or+Good%3F+Behavior+Driven+Development+within+Scrum." target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=Bad+or+Good%3F+Behavior+Driven+Development+within+Scrum.&amp;url=http%3A%2F%2Fmartinaharris.com%2F2010%2F05%2Fbad-or-good-bdd-within-scrum%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=Bad+or+Good%3F+Behavior+Driven+Development+within+Scrum.&amp;u=http%3A%2F%2Fmartinaharris.com%2F2010%2F05%2Fbad-or-good-bdd-within-scrum%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=Bad+or+Good%3F+Behavior+Driven+Development+within+Scrum.&amp;url=http%3A%2F%2Fmartinaharris.com%2F2010%2F05%2Fbad-or-good-bdd-within-scrum%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=Bad+or+Good%3F+Behavior+Driven+Development+within+Scrum.&amp;url=http%3A%2F%2Fmartinaharris.com%2F2010%2F05%2Fbad-or-good-bdd-within-scrum%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=Bad+or+Good%3F+Behavior+Driven+Development+within+Scrum.&amp;url=http%3A%2F%2Fmartinaharris.com%2F2010%2F05%2Fbad-or-good-bdd-within-scrum%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fmartinaharris.com%2F2010%2F05%2Fbad-or-good-bdd-within-scrum%2F&amp;title=Bad+or+Good%3F+Behavior+Driven+Development+within+Scrum.&amp;summary=&amp;source=" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fmartinaharris.com%2F2010%2F05%2Fbad-or-good-bdd-within-scrum%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://twitter.com/home?status=Reading+http%3A%2F%2Fmartinaharris.com%2F2010%2F05%2Fbad-or-good-bdd-within-scrum%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/buzz/post?url=http%3A%2F%2Fmartinaharris.com%2F2010%2F05%2Fbad-or-good-bdd-within-scrum%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div><div class="dzone_button" style="float: right; margin-left: 5px;">
<script type="text/javascript">
var dzone_url = 'http://martinaharris.com/2010/05/bad-or-good-bdd-within-scrum/';
var dzone_title = 'Bad or Good? Behavior Driven Development within Scrum.';
var dzone_blurb = '';
var dzone_style = '2';
</script>
<script language="javascript" src="http://widgets.dzone.com/links/widgets/zoneit.js"></script>
</div>]]></content:encoded>
			<wfw:commentRss>http://martinaharris.com/2010/05/bad-or-good-bdd-within-scrum/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hamcrest Collection Matching with Junit 4.8</title>
		<link>http://martinaharris.com/2010/04/hamcrest-collection-matching-with-junit-4-8/</link>
		<comments>http://martinaharris.com/2010/04/hamcrest-collection-matching-with-junit-4-8/#comments</comments>
		<pubDate>Tue, 27 Apr 2010 22:46:09 +0000</pubDate>
		<dc:creator>Martin Harris</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[collections]]></category>
		<category><![CDATA[hamcrest]]></category>
		<category><![CDATA[matcher]]></category>

		<guid isPermaLink="false">http://martinaharris.com/?p=989</guid>
		<description><![CDATA[Sometime back I wrote about some testing anti-patterns.  Recently I came back to the project and made some trivial changes.  I fixed a bug upgraded spring and junit and migrated the test assertions to hamcrest fluid style.  The full project &#8230; <a href="http://martinaharris.com/2010/04/hamcrest-collection-matching-with-junit-4-8/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Sometime back I wrote about some testing <a title="Test Anti Patterns" href="/2009/11/anti-patterns-testing/" target="_blank">anti-patterns</a>.  Recently I came back to the project and made some trivial changes.  I fixed a bug upgraded spring and junit and migrated the test assertions to hamcrest fluid style.  The full project is <a title="GitHub Project" href="http://github.com/mhgit/TerribleJavaTestingMadeGood" target="_blank">available on git</a>.</p>
<p>I find hamcrest to be a much cleaner way of writing assertions.  This test demonstrates the use of its fluid interface with some simple collection assertions.  There are newer versions of Hamcrest and the collection package may have moved into core, but the version I use here (1.0) was available on maven.  Note the integration with Junit.  The <strong>hasItem</strong> and <strong>hasItems</strong> methods are sourced from <strong>Junit 4.8.1</strong>.</p>
<pre class="brush: java; gutter: false; wrap-lines: false">package org.testpatterns.hamcrestexamples;

import java.util.Arrays;
import org.junit.Test;
import static org.hamcrest.collection.IsArrayContaining.hasItemInArray;
import static org.junit.matchers.JUnitMatchers.*;
import static org.junit.Assert.assertThat;

public class CollectionExamples {

  //Hamcrest with Collections and Arrays:
  static final String[] array = { "A", "B", "C" };
  static final List&lt;String&gt; list = Arrays.asList(array);

  @Test
  public void oneThingInArray () {
    assertThat(array, hasItemInArray("A"));
  }

  @Test
  public void arrayOfItemsInList () {
  String[] expected = { "A", "B", "C" };
    assertThat(list, hasItems(expected));
  }

  @Test
  public void itemInAList () {
    assertThat(list, hasItem("A"));
  }

  @Test
  public void itemsInAList () {
    assertThat(list, hasItems("A", "C"));
  }

}
</pre>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fmartinaharris.com%2F2010%2F04%2Fhamcrest-collection-matching-with-junit-4-8%2F&amp;title=Hamcrest+Collection+Matching+with+Junit+4.8" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fmartinaharris.com%2F2010%2F04%2Fhamcrest-collection-matching-with-junit-4-8%2F&amp;title=Hamcrest+Collection+Matching+with+Junit+4.8" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fmartinaharris.com%2F2010%2F04%2Fhamcrest-collection-matching-with-junit-4-8%2F&amp;title=Hamcrest+Collection+Matching+with+Junit+4.8" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fmartinaharris.com%2F2010%2F04%2Fhamcrest-collection-matching-with-junit-4-8%2F&amp;headline=Hamcrest+Collection+Matching+with+Junit+4.8" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=Hamcrest+Collection+Matching+with+Junit+4.8&amp;url=http%3A%2F%2Fmartinaharris.com%2F2010%2F04%2Fhamcrest-collection-matching-with-junit-4-8%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=Hamcrest+Collection+Matching+with+Junit+4.8&amp;u=http%3A%2F%2Fmartinaharris.com%2F2010%2F04%2Fhamcrest-collection-matching-with-junit-4-8%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=Hamcrest+Collection+Matching+with+Junit+4.8&amp;url=http%3A%2F%2Fmartinaharris.com%2F2010%2F04%2Fhamcrest-collection-matching-with-junit-4-8%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=Hamcrest+Collection+Matching+with+Junit+4.8&amp;url=http%3A%2F%2Fmartinaharris.com%2F2010%2F04%2Fhamcrest-collection-matching-with-junit-4-8%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=Hamcrest+Collection+Matching+with+Junit+4.8&amp;url=http%3A%2F%2Fmartinaharris.com%2F2010%2F04%2Fhamcrest-collection-matching-with-junit-4-8%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fmartinaharris.com%2F2010%2F04%2Fhamcrest-collection-matching-with-junit-4-8%2F&amp;title=Hamcrest+Collection+Matching+with+Junit+4.8&amp;summary=&amp;source=" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fmartinaharris.com%2F2010%2F04%2Fhamcrest-collection-matching-with-junit-4-8%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://twitter.com/home?status=Reading+http%3A%2F%2Fmartinaharris.com%2F2010%2F04%2Fhamcrest-collection-matching-with-junit-4-8%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/buzz/post?url=http%3A%2F%2Fmartinaharris.com%2F2010%2F04%2Fhamcrest-collection-matching-with-junit-4-8%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div><div class="dzone_button" style="float: right; margin-left: 5px;">
<script type="text/javascript">
var dzone_url = 'http://martinaharris.com/2010/04/hamcrest-collection-matching-with-junit-4-8/';
var dzone_title = 'Hamcrest Collection Matching with Junit 4.8';
var dzone_blurb = '';
var dzone_style = '2';
</script>
<script language="javascript" src="http://widgets.dzone.com/links/widgets/zoneit.js"></script>
</div>]]></content:encoded>
			<wfw:commentRss>http://martinaharris.com/2010/04/hamcrest-collection-matching-with-junit-4-8/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>KeySet v EntrySet code tidy</title>
		<link>http://martinaharris.com/2010/03/keyset-v-entryset-code-tidy/</link>
		<comments>http://martinaharris.com/2010/03/keyset-v-entryset-code-tidy/#comments</comments>
		<pubDate>Wed, 31 Mar 2010 18:02:25 +0000</pubDate>
		<dc:creator>Martin Harris</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[software quality]]></category>
		<category><![CDATA[entryset]]></category>
		<category><![CDATA[keyset]]></category>
		<category><![CDATA[map]]></category>

		<guid isPermaLink="false">http://martinaharris.com/?p=939</guid>
		<description><![CDATA[Its astounding how often I find maps being used like this. for(String name: names.keySet()) { mymap.put(mymap.get(name),name); }﻿ Its inefficient because you have to fetch the keys and perform a lookup in the map with the key. Instead using the EntrySet &#8230; <a href="http://martinaharris.com/2010/03/keyset-v-entryset-code-tidy/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Its astounding how often I find maps being used like this.</p>
<pre class="brush: java; gutter: false; wrap-lines: false">
for(String name: names.keySet()) {
    mymap.put(mymap.get(name),name);
}﻿
</pre>
<p>Its inefficient because you have to fetch the keys and perform a lookup in the map with the key.</p>
<p>Instead using the EntrySet you can get all the keys and values in one hit.  This saves having to perform the map lookup.</p>
<pre class="brush: java; gutter: false; wrap-lines: false">
for (Entry&lt;String, String&gt; entry : entrySet) {
    mymap.put(entry.getValue(),entry.getKey());
}
</pre>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fmartinaharris.com%2F2010%2F03%2Fkeyset-v-entryset-code-tidy%2F&amp;title=KeySet+v+EntrySet+code+tidy" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fmartinaharris.com%2F2010%2F03%2Fkeyset-v-entryset-code-tidy%2F&amp;title=KeySet+v+EntrySet+code+tidy" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fmartinaharris.com%2F2010%2F03%2Fkeyset-v-entryset-code-tidy%2F&amp;title=KeySet+v+EntrySet+code+tidy" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fmartinaharris.com%2F2010%2F03%2Fkeyset-v-entryset-code-tidy%2F&amp;headline=KeySet+v+EntrySet+code+tidy" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=KeySet+v+EntrySet+code+tidy&amp;url=http%3A%2F%2Fmartinaharris.com%2F2010%2F03%2Fkeyset-v-entryset-code-tidy%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=KeySet+v+EntrySet+code+tidy&amp;u=http%3A%2F%2Fmartinaharris.com%2F2010%2F03%2Fkeyset-v-entryset-code-tidy%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=KeySet+v+EntrySet+code+tidy&amp;url=http%3A%2F%2Fmartinaharris.com%2F2010%2F03%2Fkeyset-v-entryset-code-tidy%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=KeySet+v+EntrySet+code+tidy&amp;url=http%3A%2F%2Fmartinaharris.com%2F2010%2F03%2Fkeyset-v-entryset-code-tidy%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=KeySet+v+EntrySet+code+tidy&amp;url=http%3A%2F%2Fmartinaharris.com%2F2010%2F03%2Fkeyset-v-entryset-code-tidy%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fmartinaharris.com%2F2010%2F03%2Fkeyset-v-entryset-code-tidy%2F&amp;title=KeySet+v+EntrySet+code+tidy&amp;summary=&amp;source=" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fmartinaharris.com%2F2010%2F03%2Fkeyset-v-entryset-code-tidy%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://twitter.com/home?status=Reading+http%3A%2F%2Fmartinaharris.com%2F2010%2F03%2Fkeyset-v-entryset-code-tidy%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/buzz/post?url=http%3A%2F%2Fmartinaharris.com%2F2010%2F03%2Fkeyset-v-entryset-code-tidy%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div><div class="dzone_button" style="float: right; margin-left: 5px;">
<script type="text/javascript">
var dzone_url = 'http://martinaharris.com/2010/03/keyset-v-entryset-code-tidy/';
var dzone_title = 'KeySet v EntrySet code tidy';
var dzone_blurb = '';
var dzone_style = '2';
</script>
<script language="javascript" src="http://widgets.dzone.com/links/widgets/zoneit.js"></script>
</div>]]></content:encoded>
			<wfw:commentRss>http://martinaharris.com/2010/03/keyset-v-entryset-code-tidy/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Google Objects.equal, useful but be careful.</title>
		<link>http://martinaharris.com/2010/02/google-objects-equal-useful-but-be-careful/</link>
		<comments>http://martinaharris.com/2010/02/google-objects-equal-useful-but-be-careful/#comments</comments>
		<pubDate>Tue, 16 Feb 2010 20:20:14 +0000</pubDate>
		<dc:creator>Martin Harris</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[software quality]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[compareto]]></category>
		<category><![CDATA[equals]]></category>
		<category><![CDATA[google]]></category>

		<guid isPermaLink="false">http://martinaharris.com/?p=818</guid>
		<description><![CDATA[Google have a nice equals method to make boiler plate equals easier to read. Particularly good if you have many attributes in the method. http://publicobject.com/2007/09/coding-in-small-with-google-collections_8175.html Be careful to check that your objects are consistent with equals though.  I have mentioned &#8230; <a href="http://martinaharris.com/2010/02/google-objects-equal-useful-but-be-careful/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Google have a nice equals method to make boiler plate equals easier to read.  Particularly good if you have many attributes in the method.  <a title="Google Object.equals method." href="http://publicobject.com/2007/09/coding-in-small-with-google-collections_8175.html" target="_blank">http://publicobject.com/2007/09/coding-in-small-with-google-collections_8175.html</a></p>
<p>Be careful to check that your objects are consistent with equals though.  I have mentioned this <a title="Equals Generation" href="/2009/10/ide-generation-of-equals-methods-has-its-moments/" target="_blank">before</a>.<br />
<span id="more-818"></span><br />
In the following method I am using the Objects.equal with a BigDecimal class.  It does not work because BigDecimal equals treats 0 and 0.0 as not equal, which is probably not what you need.</p>
<pre class="brush: java; light: true">
public boolean equals(Object obj) {
    if (obj == null) {
      return false;
    }
    if (getClass() != obj.getClass()) {
      return false;
    }

    final TestEquals other = (TestEquals) obj;

    return Objects.equal(this.bigDecimal, other);
}</pre>
<p>The common solution is to use the compareTo method instead like so.</p>
<pre class="brush: java; light: true">  final TestEquals other = (TestEquals) obj;
  if (this.bigDecimal != other.bigDecimal &amp;&amp;
      (this.bigDecimal == null
      || this.bigDecimal.compareTo(other.bigDecimal) != 0)) {
    return false;
  }
  return true;</pre>
<p>I will be using this technique, especially where the object has many attributes but I will be <a title="Testing Equals" href="/2009/10/testing-java-equals-and-hashcode-methods-essential/" target="_blank">testing the equals method</a>.</p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fmartinaharris.com%2F2010%2F02%2Fgoogle-objects-equal-useful-but-be-careful%2F&amp;title=Google+Objects.equal%2C+useful+but+be+careful." target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fmartinaharris.com%2F2010%2F02%2Fgoogle-objects-equal-useful-but-be-careful%2F&amp;title=Google+Objects.equal%2C+useful+but+be+careful." target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fmartinaharris.com%2F2010%2F02%2Fgoogle-objects-equal-useful-but-be-careful%2F&amp;title=Google+Objects.equal%2C+useful+but+be+careful." target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fmartinaharris.com%2F2010%2F02%2Fgoogle-objects-equal-useful-but-be-careful%2F&amp;headline=Google+Objects.equal%2C+useful+but+be+careful." target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=Google+Objects.equal%2C+useful+but+be+careful.&amp;url=http%3A%2F%2Fmartinaharris.com%2F2010%2F02%2Fgoogle-objects-equal-useful-but-be-careful%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=Google+Objects.equal%2C+useful+but+be+careful.&amp;u=http%3A%2F%2Fmartinaharris.com%2F2010%2F02%2Fgoogle-objects-equal-useful-but-be-careful%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=Google+Objects.equal%2C+useful+but+be+careful.&amp;url=http%3A%2F%2Fmartinaharris.com%2F2010%2F02%2Fgoogle-objects-equal-useful-but-be-careful%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=Google+Objects.equal%2C+useful+but+be+careful.&amp;url=http%3A%2F%2Fmartinaharris.com%2F2010%2F02%2Fgoogle-objects-equal-useful-but-be-careful%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=Google+Objects.equal%2C+useful+but+be+careful.&amp;url=http%3A%2F%2Fmartinaharris.com%2F2010%2F02%2Fgoogle-objects-equal-useful-but-be-careful%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fmartinaharris.com%2F2010%2F02%2Fgoogle-objects-equal-useful-but-be-careful%2F&amp;title=Google+Objects.equal%2C+useful+but+be+careful.&amp;summary=&amp;source=" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fmartinaharris.com%2F2010%2F02%2Fgoogle-objects-equal-useful-but-be-careful%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://twitter.com/home?status=Reading+http%3A%2F%2Fmartinaharris.com%2F2010%2F02%2Fgoogle-objects-equal-useful-but-be-careful%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/buzz/post?url=http%3A%2F%2Fmartinaharris.com%2F2010%2F02%2Fgoogle-objects-equal-useful-but-be-careful%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div><div class="dzone_button" style="float: right; margin-left: 5px;">
<script type="text/javascript">
var dzone_url = 'http://martinaharris.com/2010/02/google-objects-equal-useful-but-be-careful/';
var dzone_title = 'Google Objects.equal, useful but be careful.';
var dzone_blurb = '';
var dzone_style = '2';
</script>
<script language="javascript" src="http://widgets.dzone.com/links/widgets/zoneit.js"></script>
</div>]]></content:encoded>
			<wfw:commentRss>http://martinaharris.com/2010/02/google-objects-equal-useful-but-be-careful/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Leveraging Eclipse for TDD</title>
		<link>http://martinaharris.com/2010/02/leveraging-eclipse-for-tdd/</link>
		<comments>http://martinaharris.com/2010/02/leveraging-eclipse-for-tdd/#comments</comments>
		<pubDate>Mon, 01 Feb 2010 05:00:03 +0000</pubDate>
		<dc:creator>Martin Harris</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[agile]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[ide]]></category>
		<category><![CDATA[junit]]></category>
		<category><![CDATA[re-factor]]></category>

		<guid isPermaLink="false">http://martinaharris.com/?p=722</guid>
		<description><![CDATA[I have found that quite a few programmers struggle to work in a completely test driven fashion. I myself whilst writing tests for many years, took a long time to move over to writing the test first. I think one &#8230; <a href="http://martinaharris.com/2010/02/leveraging-eclipse-for-tdd/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I have found that quite a few programmers struggle to work in a completely test driven fashion.  I myself whilst writing tests for many years, took a long time to move over to writing the test first.  I think one of my problems was that I always wanted to do my thinking in the implementation class.  Recently I have found a great way to leverage the Eclipse IDE&#8217;s code complete functions so that its more natural to work from the test class.</p>
<p>The idea is to save effort and time by getting Eclipse to create the implementation side.  I have long been used to changing the code, and then using code complete to refactor.  For instance you can change a class name or package name, and use CTRL-1 to get a list of options on the code that will not compile.  Then use an option to move or rename the class performing the re-factor.</p>
<p>This turns out to be a very powerful technique for driving development from the test.</p>
<p>Try out this simple example I think it makes it more natural to TDD, but I would be interested in your comments.<br />
<span id="more-722"></span><br />
Start by creating a test class the usual way, and put your test method in it.</p>
<pre class="brush: java; light: true">@Test
public void testDrivingFromTheIde () {

}</pre>
<p>Next I need a new service type, and an implementation.  So in the test just type what you think you will need.</p>
<pre class="brush: java; light: true">public void testDrivingFromTheIde () {

long factor;
NumberCruncher numberCruncher = new ComplexNumberCruncher(factor);

}</pre>
<p>The new code does not compile as its missing the classes, so driving from the test, press your code complete key, CTRL+1 in eclipse.  Up pops a list of operations like this:</p>
<div id="attachment_727" class="wp-caption alignleft" style="width: 160px"><a href="http://martinaharris.com/wp-content/uploads/2010/01/1first-interface.jpg"><img class="size-thumbnail wp-image-727" title="1first-interface" src="http://martinaharris.com/wp-content/uploads/2010/01/1first-interface-150x150.jpg" alt="Code complete options showing create class and interface" width="150" height="150" /></a><p class="wp-caption-text">Code complete options showing create class and interface</p></div>
<p>Select create new interface, remember to change the location from test to main or the class will be created in the wrong folder.  Note if your using netbeans you don&#8217;t get as rich an editing experience, it only gives you the option to create a class, and in the wrong folder, so you have to move it and change it to an interface.  This undoes what I am trying to achieve, which is to spend as much time in the test class as possible.</p>
<div id="attachment_728" class="wp-caption alignright" style="width: 160px"><a href="http://martinaharris.com/wp-content/uploads/2010/01/2first-interface.jpg"><img class="size-thumbnail wp-image-728" title="2first-interface" src="http://martinaharris.com/wp-content/uploads/2010/01/2first-interface-150x150.jpg" alt="Creating an interface" width="150" height="150" /></a><p class="wp-caption-text">Creating an interface</p></div>
<p>Back in the ide you will be looking at your new class, hit ALT-left to return to the test class.  Note its still not compiling so again, as an alternative this time just hover over the problem and select create new constructor from the options.</p>
<p>Finally back in the class you can fix the remaining problem and initialize the variable.  Now add the call under test to the code, and again use code complete to add the method to the interface.  Navigate to the ComplexNumberCruncher class and a quick CTRL+1 will give you the option to add unimplemented methods from the interface.  Save and move back to the test again.  Add your missing assertions and run the test, it should fail.</p>
<p>At this point you have written a few lines of test, and managed to generate the implementation skeleton.  All that remains is to finally implement the compute method.  This bit eclipse will not do for you.  <img src='http://martinaharris.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />   So switch back to your compute method, and implement it.  In a more complex implementation you may find yourself adding more assertions, and implementation incrementally.  This is pretty normal.  For me leveraging eclipse makes it much easier to write the code in a true TDD way.  Less typing and I am sure it takes less time.</p>
<pre class="brush: java; light: true">public void testDrivingFromTheIde () {

		long factor = 5;
		NumberCruncher numberCruncher = new ComplexNumberCruncher(factor);

		long value = 10;
		long result = numberCruncher.compute(value);

		assertNotNull(result);
		assertEquals("5 x 10 = 50",(factor*value),result);
}

public interface NumberCruncher {

		long compute(long i);
}

public class ComplexNumberCruncher implements NumberCruncher {

	private final long factor;

	public ComplexNumberCruncher(long factor) {
		this.factor = factor;
	}

	@Override
	public long compute(long value) {

		return (this.factor * value);
	}

}</pre>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fmartinaharris.com%2F2010%2F02%2Fleveraging-eclipse-for-tdd%2F&amp;title=Leveraging+Eclipse+for+TDD" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fmartinaharris.com%2F2010%2F02%2Fleveraging-eclipse-for-tdd%2F&amp;title=Leveraging+Eclipse+for+TDD" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fmartinaharris.com%2F2010%2F02%2Fleveraging-eclipse-for-tdd%2F&amp;title=Leveraging+Eclipse+for+TDD" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fmartinaharris.com%2F2010%2F02%2Fleveraging-eclipse-for-tdd%2F&amp;headline=Leveraging+Eclipse+for+TDD" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=Leveraging+Eclipse+for+TDD&amp;url=http%3A%2F%2Fmartinaharris.com%2F2010%2F02%2Fleveraging-eclipse-for-tdd%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=Leveraging+Eclipse+for+TDD&amp;u=http%3A%2F%2Fmartinaharris.com%2F2010%2F02%2Fleveraging-eclipse-for-tdd%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=Leveraging+Eclipse+for+TDD&amp;url=http%3A%2F%2Fmartinaharris.com%2F2010%2F02%2Fleveraging-eclipse-for-tdd%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=Leveraging+Eclipse+for+TDD&amp;url=http%3A%2F%2Fmartinaharris.com%2F2010%2F02%2Fleveraging-eclipse-for-tdd%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=Leveraging+Eclipse+for+TDD&amp;url=http%3A%2F%2Fmartinaharris.com%2F2010%2F02%2Fleveraging-eclipse-for-tdd%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fmartinaharris.com%2F2010%2F02%2Fleveraging-eclipse-for-tdd%2F&amp;title=Leveraging+Eclipse+for+TDD&amp;summary=&amp;source=" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fmartinaharris.com%2F2010%2F02%2Fleveraging-eclipse-for-tdd%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://twitter.com/home?status=Reading+http%3A%2F%2Fmartinaharris.com%2F2010%2F02%2Fleveraging-eclipse-for-tdd%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/buzz/post?url=http%3A%2F%2Fmartinaharris.com%2F2010%2F02%2Fleveraging-eclipse-for-tdd%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div><div class="dzone_button" style="float: right; margin-left: 5px;">
<script type="text/javascript">
var dzone_url = 'http://martinaharris.com/2010/02/leveraging-eclipse-for-tdd/';
var dzone_title = 'Leveraging Eclipse for TDD';
var dzone_blurb = '';
var dzone_style = '2';
</script>
<script language="javascript" src="http://widgets.dzone.com/links/widgets/zoneit.js"></script>
</div>]]></content:encoded>
			<wfw:commentRss>http://martinaharris.com/2010/02/leveraging-eclipse-for-tdd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

