<?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/"
		xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
	xmlns:media="http://search.yahoo.com/mrss/"
>

<channel>
	<title>Frank Carver&#039;s Punch Barrel &#187; software</title>
	<atom:link href="http://blog.punchbarrel.com/tag/software/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.punchbarrel.com</link>
	<description>Frank Carver&#039;s musings about software and life</description>
	<lastBuildDate>Thu, 08 Dec 2011 22:58:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<copyright>Copyright &#xA9; Frank Carver&#039;s Punch Barrel 2010 </copyright>
	<managingEditor>frank.carver@googlemail.com (Frank Carver&#039;s Punch Barrel)</managingEditor>
	<webMaster>frank.carver@googlemail.com (Frank Carver&#039;s Punch Barrel)</webMaster>
	<ttl>1440</ttl>
	<image>
		<url>http://punchbarrel.com/images/punchbarrel-144.jpg</url>
		<title>Frank Carver&#039;s Punch Barrel</title>
		<link>http://blog.punchbarrel.com</link>
		<width>144</width>
		<height>144</height>
	</image>
	<itunes:subtitle></itunes:subtitle>
	<itunes:summary>Frank Carver&#039;s musings about software and life</itunes:summary>
	<itunes:keywords></itunes:keywords>
	<itunes:category text="Society &#38; Culture" />
	<itunes:author>Frank Carver&#039;s Punch Barrel</itunes:author>
	<itunes:owner>
		<itunes:name>Frank Carver&#039;s Punch Barrel</itunes:name>
		<itunes:email>frank.carver@googlemail.com</itunes:email>
	</itunes:owner>
	<itunes:block>no</itunes:block>
	<itunes:explicit>no</itunes:explicit>
	<itunes:image href="http://punchbarrel.com/images/punchbarrel-144.jpg" />
		<item>
		<title>Learned helplessness in the workplace</title>
		<link>http://blog.punchbarrel.com/2011/06/21/learned-helplessness-in-the-workplace/</link>
		<comments>http://blog.punchbarrel.com/2011/06/21/learned-helplessness-in-the-workplace/#comments</comments>
		<pubDate>Tue, 21 Jun 2011 13:01:25 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[Information]]></category>
		<category><![CDATA[agile]]></category>
		<category><![CDATA[coaching]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[expetriment]]></category>
		<category><![CDATA[helpless]]></category>
		<category><![CDATA[learning]]></category>
		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://blog.punchbarrel.com/?p=1644</guid>
		<description><![CDATA[Thinking of giving up trying because nothing seems to make a difference? Jason Yip has an interesting article about how a feeling of helplessness is easily learned, but can be overcome, even in software development. Learned helplessness in the workplace.]]></description>
			<content:encoded><![CDATA[<p>Thinking of giving up trying because nothing seems to make a difference? Jason Yip has an interesting article about how a feeling of helplessness is easily learned, but can be overcome, even in software development.</p>
<p><a href="http://jchyip.blogspot.com/2011/06/learned-helplessness-in-workplace.html">Learned helplessness in the workplace</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.punchbarrel.com/2011/06/21/learned-helplessness-in-the-workplace/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TDD: Driving from the assertion up</title>
		<link>http://blog.punchbarrel.com/2010/06/18/tdd-driving-from-the-assertion-up/</link>
		<comments>http://blog.punchbarrel.com/2010/06/18/tdd-driving-from-the-assertion-up/#comments</comments>
		<pubDate>Fri, 18 Jun 2010 13:57:53 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[Information]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[TDD]]></category>

		<guid isPermaLink="false">http://blog.punchbarrel.com/?p=1554</guid>
		<description><![CDATA[I&#8217;m doing quite a lot of agile and TDD mentoring at the moment, so such things are always floating near the top of my mind. A recent article from Mark Needham presents an interesting view on how to construct code within tests, and the impact that might have on how tests drive design of code.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m doing quite a lot of agile and TDD mentoring at the moment, so such things are always floating near the top of my mind.</p>
<p><a href="http://www.markhneedham.com/blog/2010/06/14/tdd-driving-from-the-assertion-up/">A recent article from Mark Needham</a> presents an interesting view on how to construct code within tests, and the impact that might have on how tests drive design of code.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.punchbarrel.com/2010/06/18/tdd-driving-from-the-assertion-up/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>REST and versioning, a more concrete example.</title>
		<link>http://blog.punchbarrel.com/2010/06/15/rest-and-versioning-a-more-concrete-example/</link>
		<comments>http://blog.punchbarrel.com/2010/06/15/rest-and-versioning-a-more-concrete-example/#comments</comments>
		<pubDate>Mon, 14 Jun 2010 23:11:39 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[Information]]></category>
		<category><![CDATA[architecture]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[maintenance]]></category>
		<category><![CDATA[REST]]></category>
		<category><![CDATA[SOAP]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[version]]></category>

		<guid isPermaLink="false">http://blog.punchbarrel.com/?p=1541</guid>
		<description><![CDATA[There&#8217;s an interesting discussion going on at The Wisdom of Ganesh in which Ganesh Prasad and &#8220;Integral ):( Reporting&#8221; (presumably the &#8220;JJ Dubray&#8221; mentioned in the article) are trying to work out some issues around versioning, REST and SOAP. This post is also referenced and commented on at infoQ. In the 14th comment to the [...]]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s an interesting discussion going on at <a href="http://wisdomofganesh.blogspot.com/2010/06/does-rest-need-versioning.html">The Wisdom of Ganesh</a> in which Ganesh Prasad and &#8220;<em>Integral ):( Reporting</em>&#8221; (presumably the &#8220;JJ Dubray&#8221; mentioned in the article) are trying to work out some issues around versioning, REST and SOAP. This post is also referenced and commented on at <a href="http://www.infoq.com/news/2010/06/rest-versioning">infoQ</a>.</p>
<p>In the 14th comment to the original article, JJ calls for a real-world example &#8211; this is a good idea which should help ground the discussion and diffuse the temptation to communicate in abstract principles.  In the spirit of this request, I will describe an example based on problems I faced in a previous job.</p>
<p>The first version of the system we were working on consisted of a server component, coded in Java, which provided remote services to several client systems. Each of the client systems was a Java web application, responsible for providing customer-specific web pages and navigation using the services and content provided by the central server. For some customers there would be just one instance of the web client, for others with greater load there would be several.</p>
<p>The server system was responsible for managing products for sale, including descriptions in multiple languages, format and compatibility meta-data, thumbnail images in several sizes, prices in multiple currencies. As well as access to individual items and collections, a search facility provided a way to discover or look up products. The server also managed customer details and purchase histories, and handled both delivery of content and general messaging (by email and SMS) during the purchase process. The client systems were responsible for display and navigation of a product catalogue, customer branding, &#8220;shopping cart&#8221;, login/logout, and everything else a user experiences.</p>
<p>The API between client and server included ways to list products by category, fetch details of specific products, search using a variety of criteria, make and cancel purchases, fetch and update user data and so on.</p>
<p>I suggest this should be a reasonable system on which to base a discussion &#8211; it embodies similar concepts to many other systems, and is neither trivial nor impossible to build. Interestingly, both SOAP and REST versions of the interface between the clients and the server were implemented at different points in the life of the product.</p>
<p>So, on to versioning. It seems to me that there are several kinds of changes which might require versioning. I will list a few here, but I welcome suggestions for others I might have missed.</p>
<ul>
<li>The first deployment of the system worked with only a single currency. The move to multiple currencies was a potentially major change in the interaction between client and server, even though each client works only in a single currency.</li>
<li>The customer for one client implementation required the provision of extra services, specific to their market, which were not required by (and should not be available to) other clients.</li>
<li>The initial version of the search facility returned data for all matches, with paging through the results implemented entirely on the client. When there was a lot of data in the catalogue this became an unacceptable performance bottleneck, especially as results beyond the first few pages were hardly ever viewed. An alternative approach was suggested where a client would request a specified page (of a specified page size) from the search results. This required changes in both the search request and search results.</li>
<li>A new source of products introduced the idea of collections. Items in a collection could be purchased individually or as a bundle. Viewing a collection while browsing, searching, or in a user&#8217;s purchase history, should allow a user to &#8220;drill in&#8221; to the collection to view the items within it. Items located while searching should indicate how to purchase the collection, as well as how to purchase the individual item.</li>
</ul>
<p>Is this a useful amount of detail for a scenario? I have my own experiences of working with this system and the choices we made, but I&#8217;d love to read any suggestions for how you might handle any of the transitions above in a live system with multiple client systems deployed, many of which can not be changed easily or often, and a server full of historical purchase data. Procedural remoting approaches (SOAP, XML-RPC and Java RMI etc.) and resource-based approaches (REST) are all welcome.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.punchbarrel.com/2010/06/15/rest-and-versioning-a-more-concrete-example/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Snakes on the Web: what&#8217;s really wrong with web development</title>
		<link>http://blog.punchbarrel.com/2009/09/06/snakes-on-the-web-whats-really-wrong-with-web-development/</link>
		<comments>http://blog.punchbarrel.com/2009/09/06/snakes-on-the-web-whats-really-wrong-with-web-development/#comments</comments>
		<pubDate>Sun, 06 Sep 2009 08:50:42 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[Information]]></category>
		<category><![CDATA[concurrency]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://blog.punchbarrel.com/?p=1382</guid>
		<description><![CDATA[I don&#8217;t really consider myself a Python developer, although I have dabbled. As with many of the less mainstream languages there are keen developers and thinkers trying to clear away the confusion and push the limits of what is possible. Snakes on the Web The article is an enthusiastic call to action for &#8220;Pythonistas&#8221;, but [...]]]></description>
			<content:encoded><![CDATA[<p>I don&#8217;t really consider myself a Python developer, although I have dabbled. As with many of the less mainstream languages there are keen developers and thinkers trying to clear away the confusion and push the limits of what is possible.</p>
<p><a href="http://jacobian.org/writing/snakes-on-the-web/">Snakes on the Web</a></p>
<p>The article is an enthusiastic call to action for &#8220;Pythonistas&#8221;, but also a really useful summary of big problems and issues applicable to any language, framework or development approach. Read it, even if just for the excellent (and scary) summary of all the things a modern web application developer needs to be aware of.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.punchbarrel.com/2009/09/06/snakes-on-the-web-whats-really-wrong-with-web-development/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to be a program manager</title>
		<link>http://blog.punchbarrel.com/2009/03/17/how-to-be-a-program-manager/</link>
		<comments>http://blog.punchbarrel.com/2009/03/17/how-to-be-a-program-manager/#comments</comments>
		<pubDate>Tue, 17 Mar 2009 10:39:16 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[Information]]></category>
		<category><![CDATA[Brooks]]></category>
		<category><![CDATA[management]]></category>
		<category><![CDATA[program]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[teams]]></category>

		<guid isPermaLink="false">http://blog.punchbarrel.com/?p=1233</guid>
		<description><![CDATA[I think its fair to say that a lot of attempts to &#8220;manage&#8221; software projects and software teams simply do not work. This is not a new problem, and a lot of smart people have had a go at it. Recently, software and business pundit Joel Spolsky has waded in, with his take on the [...]]]></description>
			<content:encoded><![CDATA[<p>I think its fair to say that a lot of attempts to &#8220;manage&#8221; software projects and software teams simply do not work. This is not a new problem, and a lot of smart people have had a go at it.</p>
<p>Recently, software and business pundit Joel Spolsky has waded in, with his take on the importance of  a &#8220;program manager&#8221;.</p>
<p><a href="http://www.joelonsoftware.com/items/2009/03/09.html">How to be a program manager &#8211; Joel on Software</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.punchbarrel.com/2009/03/17/how-to-be-a-program-manager/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Test-Driven Development of HTTP and REST interfaces with Mojasef</title>
		<link>http://blog.punchbarrel.com/2009/01/07/test-driven-development-of-http-and-rest-interfaces-with-mojasef/</link>
		<comments>http://blog.punchbarrel.com/2009/01/07/test-driven-development-of-http-and-rest-interfaces-with-mojasef/#comments</comments>
		<pubDate>Wed, 07 Jan 2009 09:15:42 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[Information]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[HTTP]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[mojasef]]></category>
		<category><![CDATA[REST]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[stringtree]]></category>
		<category><![CDATA[TDD]]></category>
		<category><![CDATA[tests]]></category>

		<guid isPermaLink="false">http://blog.punchbarrel.com/?p=691</guid>
		<description><![CDATA[Test-Driven Development (TDD) of HTTP and REST interfaces can be tricky. This post contains some examples of how to do it using the open source Mojasef toolkit. I was prompted to write this post after recently finding and fixing an irritating bug using just this technique. First, let&#8217;s set the scene. In TDD the rules [...]]]></description>
			<content:encoded><![CDATA[<p>Test-Driven Development (TDD) of HTTP and REST interfaces can be tricky. This post contains some examples of how to do it using the open source <a href="http://mojasef.stringtree.org/">Mojasef</a> toolkit. I was prompted to write this post after recently finding and fixing an irritating bug using just this technique.</p>
<p>First, let&#8217;s set the scene. In TDD the rules are very simple: No production code is written without a failing test; just enough code is written to satisfy the current set of tests; duplication is mercilessly refactored. TDD is a very powerful and effective technique which can improve both the quality and delivery time of software. HTTP and REST interfaces provide access to a system or component using the HTTP protocol. This access may be by fetching HTML or WML pages, for example, or it may be by sending,  receiving and updating resources in some other format such as XML or JSON.</p>
<p>For a first scenario imagine we have an existing HTTP interface for which we want to write a client using TDD. This service is relatively simple to start with. To send a message requires a POST request to a particular URL with two parameters &#8220;destination&#8221; and &#8220;text&#8221;. If the destination is valid, the text message is sent to the destination and a &#8220;200&#8243; status code is returned. If the destination is not recognized, a &#8220;404&#8243; status code is returned. This interface is <em>so</em> simple that it is tempting to just write the client, test it manually and move on. But if we were to do that, then we might not think of all the test case possibilities, and there would be no regression tests to help protect the software from unexpected side-effects later. So we opt to do the right thing, and use TDD.</p>
<p>For the sake of simplicity, I will assume we are using the Stringtree HTTPClient as <a href="http://blog.punchbarrel.com/2008/01/07/a-simple-http-client-part-1-overview/">described in an earlier post</a>. So let&#8217;s start with a simple test to make sure the code compiles and the test libraries and stuff are in place:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.stringtree.http.*</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> MessageSendingTest <span style="color: #000000; font-weight: bold;">extends</span> junit.<span style="color: #006633;">framework</span>.<span style="color: #006633;">TestCase</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> testExceptionFromUnknownURL<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    Form form <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Form<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    form.<span style="color: #006633;">put</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;destination&quot;</span>, <span style="color: #0000ff;">&quot;name@example.com&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    form.<span style="color: #006633;">put</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;text&quot;</span>, <span style="color: #0000ff;">&quot;hello from HTTP&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    HTTPClient client <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> HTTPClient<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
      client.<span style="color: #006633;">post</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;http://localhost:9999/send&quot;</span>, form<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      fail<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;should throw an exception&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">Exception</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>This test serves two purposes. First, compiling it helps drive the structure of the test case, what classes need to be imported and so on. Second it documents the expected behaviour of our client if the server is not running or not where it is expected to be.  I always like to start with this sort of &#8220;null&#8221; test case wherever possible. Once we get this test working we are ready to move on to the next step, testing against an actual server.</p>
<p>It might be possible to test against a real server, perhaps by manually examining log files, or checking the actual receipt of a message. Feel free to do that, but understand that that is really integration testing rather than unit testing, and neither helps us design and debug the client, nor document and enforce the proper behaviour of our code once we move on to other work. To gain these benefits we need a server which may be started, examined and stopped quickly and under the control of a simple unit test. This is where <a href="http://mojasef.stringtree.org/">Mojasef</a> comes in.</p>
<p>Mojasef is a server and web application framework designed for efficient test-driven development of web applications. Although usually used for building applications, it is just as suitable for building test harnesses. In this case we will build a simple application which implements the HTTP interface described above. And yes, we will do it using TDD, so we leave the MessageSendingTest for the moment and start a new one to drive our test harness without requiring HTTP. As usual, I start with a &#8220;null&#8221; test to get started:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> MessageHarnessTest <span style="color: #000000; font-weight: bold;">extends</span> junit.<span style="color: #006633;">framework</span>.<span style="color: #006633;">TestCase</span> <span style="color: #009900;">&#123;</span>
  MessageHarness harness<span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setUp<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    harness <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> MessageHarness<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> testNoAction<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    assertFalse<span style="color: #009900;">&#40;</span>harness.<span style="color: #006633;">wasCalled</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>This won&#8217;t compile without a MessageHarness class, so let&#8217;s make the minimum necessary.</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> MessageHarness <span style="color: #009900;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">boolean</span> wasCalled<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">false</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Good, our test now runs, so let&#8217;s add some behaviour. First another test:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> testCalledWithoutArguments<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    harness.<span style="color: #006633;">send</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    assertTrue<span style="color: #009900;">&#40;</span>harness.<span style="color: #006633;">wasCalled</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span></pre></div></div>

<p>To make this compile we need to add another method to MessageHarness</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> send<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #009900;">&#125;</span></pre></div></div>

<p>Our new test fails, so we need to make it work.</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> MessageHarness <span style="color: #009900;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">boolean</span> called <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">false</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">boolean</span> wasCalled<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">return</span> called<span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> send<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    called <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>That seems enough to start with. Now back to the main test case. Add a new test to call the application we have just built over HTTP and check that all the communication stuff works. With a bit of refactoring to keep the tests clean and duplication low.</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.stringtree.http.*</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.stringtree.mojasef.standalone.InlineServer</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> MessageSendingTest <span style="color: #000000; font-weight: bold;">extends</span> junit.<span style="color: #006633;">framework</span>.<span style="color: #006633;">TestCase</span> <span style="color: #009900;">&#123;</span>
  HTTPClient client<span style="color: #339933;">;</span>
  Form form<span style="color: #339933;">;</span>
  InlineServer server<span style="color: #339933;">;</span>
  MessageHarness app<span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setUp<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">Exception</span> <span style="color: #009900;">&#123;</span>
    client <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> HTTPClient<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    form <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Form<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    app <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> MessageHarness<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    server <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> InlineServer<span style="color: #009900;">&#40;</span>app, <span style="color: #0000ff;">&quot;9998&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    server.<span style="color: #006633;">start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> tearDown<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	server.<span style="color: #006633;">halt</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> testExceptionFromUnknownURL<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    form.<span style="color: #006633;">put</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;destination&quot;</span>, <span style="color: #0000ff;">&quot;name@example.com&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    form.<span style="color: #006633;">put</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;text&quot;</span>, <span style="color: #0000ff;">&quot;hello from HTTP&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
      client.<span style="color: #006633;">post</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;http://localhost:9999/send&quot;</span>, form<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      fail<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;should throw an exception&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">Exception</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> testHarnessWiring<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">Exception</span> <span style="color: #009900;">&#123;</span>
    form.<span style="color: #006633;">put</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;destination&quot;</span>, <span style="color: #0000ff;">&quot;unknown@example.com&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    form.<span style="color: #006633;">put</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;text&quot;</span>, <span style="color: #0000ff;">&quot;hello from HTTP&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    assertFalse<span style="color: #009900;">&#40;</span>app.<span style="color: #006633;">wasCalled</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    client.<span style="color: #006633;">post</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;http://localhost:9998/send&quot;</span>, form<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    assertTrue<span style="color: #009900;">&#40;</span>app.<span style="color: #006633;">wasCalled</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>This probably needs a bit of explanation. The MessageHarness class we produced above is a Mojasef web application. Really, without any other configuration, base classes or nonsense. It&#8217;s just a &#8220;plain old Java object&#8221; (POJO). The job of the Mojasef code is to take an object of that class and make its methods available as HTTP URLs.</p>
<p>To serve it over HTTP we <em>could</em> use a MojasefServlet and run it in any Servlet Container, but for this test we want an ultra-light server which can be started and stopped in a test. So we use the InlineServer provided in the Mojasef jar. It&#8217;s a real HTTP server which you can use from a regular web browser, but it&#8217;s mainly designed for streamlined use in tests.</p>
<p>This server is configured to serve the MessageHarness application on port 9998. Having configured the server we start it in startUp and stop it in tearDown to ensure that nothing is left behind between tests.</p>
<p>The new test makes a HTTP request to the freshly started server, then checks (by calling the MessageHarness method we created earlier) that the test harness application was successfully called. This verifies that the server has been correctly started and called.</p>
<p>It&#8217;s still not really testing the message API. To do that we need more tests.</p>
<p>Now, we know from the introduction above that our resource should return a HTTP 404 (&#8220;not found&#8221;) error if we try to send to an unrecognised address.</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> test404FromUnknownDestination<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">Exception</span> <span style="color: #009900;">&#123;</span>
    form.<span style="color: #006633;">put</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;destination&quot;</span>, <span style="color: #0000ff;">&quot;unknown@example.com&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    form.<span style="color: #006633;">put</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;text&quot;</span>, <span style="color: #0000ff;">&quot;hello from HTTP&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #003399;">Document</span> result <span style="color: #339933;">=</span> client.<span style="color: #006633;">post</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;http://localhost:9998/send&quot;</span>, form<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    assertEquals<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;404&quot;</span>, result.<span style="color: #006633;">getHeader</span><span style="color: #009900;">&#40;</span>HTTPClient.<span style="color: #006633;">HTTP_RESPONSE_CODE</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span></pre></div></div>

<p>Making this test work is pretty simple, especially as we have no other tests which say anything about the HTTP Response code. The only &#8220;cleverness&#8221; is that we now need to use some slightly smarter features of the Mojasef code.</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.stringtree.finder.StringKeeper</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.stringtree.mojasef.HTTPConstants</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> MessageHarness <span style="color: #009900;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">boolean</span> called <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">false</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">boolean</span> wasCalled<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">return</span> called<span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> send<span style="color: #009900;">&#40;</span>StringKeeper context<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    called <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span>
    context.<span style="color: #006633;">put</span><span style="color: #009900;">&#40;</span>HTTPConstants.<span style="color: #006633;">RESPONSE_CODE</span>, <span style="color: #0000ff;">&quot;404&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Mojasef will try a variety of ways to call a public method. We have seen the basic one &#8211; a method with no parameters mapped directly to a URL. This is another one &#8211; a  method taking a &#8220;context&#8221; as an argument. This context will be pre-loaded with any POST or URL parameters, as well as any request headers and plenty of other stuff which is not of interest right now. This context also provides a way of setting information to be sent back to the client.</p>
<p>Now, our application code is passing all its tests, but it does so by returning a &#8220;404&#8243; error code for all requests. This is not really desirable behaviour, so we need another test:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> test200FromKnownDestination<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">Exception</span> <span style="color: #009900;">&#123;</span>
    form.<span style="color: #006633;">put</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;destination&quot;</span>, <span style="color: #0000ff;">&quot;known@example.com&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    form.<span style="color: #006633;">put</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;text&quot;</span>, <span style="color: #0000ff;">&quot;hello from HTTP&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #003399;">Document</span> result <span style="color: #339933;">=</span> client.<span style="color: #006633;">post</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;http://localhost:9998/send&quot;</span>, form<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    assertEquals<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;200&quot;</span>, result.<span style="color: #006633;">getHeader</span><span style="color: #009900;">&#40;</span>HTTPClient.<span style="color: #006633;">HTTP_RESPONSE_CODE</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span></pre></div></div>

<p>This test fails, so we need to modify the application to add some understanding of the supplied form data.</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.stringtree.finder.StringKeeper</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.stringtree.mojasef.HTTPConstants</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> MessageHarness <span style="color: #009900;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">boolean</span> called <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">false</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">boolean</span> wasCalled<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">return</span> called<span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> send<span style="color: #009900;">&#40;</span>StringKeeper context<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    called <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span>
    <span style="color: #003399;">String</span> destination <span style="color: #339933;">=</span> context.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;destination&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;known@example.com&quot;</span>.<span style="color: #006633;">equals</span><span style="color: #009900;">&#40;</span>destination<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        context.<span style="color: #006633;">put</span><span style="color: #009900;">&#40;</span>HTTPConstants.<span style="color: #006633;">RESPONSE_CODE</span>, <span style="color: #0000ff;">&quot;200&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
        context.<span style="color: #006633;">put</span><span style="color: #009900;">&#40;</span>HTTPConstants.<span style="color: #006633;">RESPONSE_CODE</span>, <span style="color: #0000ff;">&quot;404&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Now we reach an interesting point in the development process. It is perfectly feasible to continue in this vein, step-by-step bringing the application into existence. However, even the streamlined InlineServer still needs to set itself up, bind and unbind ports, deal with network traffic and so on. This is considerably slower than a regular method call, and as more tests are added the test case will continue to slow down.</p>
<p>The advantages of the Mojasef approach to web applications really begin to pay off at this point. The tests we already have prove the basics of HTTP Communication are working, so further tests do not really need to bother with HTTP, <em>provided the tests are testing exactly the same code</em>. Luckily (as pointed out earlier) a Mojasef application is just a regular Java class, which needs no modification to be tested using regular JUnit tests. Here are the same tests as above, but implemented as simple method calls:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.stringtree.finder.StringKeeper</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.stringtree.mojasef.HTTPConstants</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.stringtree.mojasef.HTTPConstants</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> MessageProcessingTest <span style="color: #000000; font-weight: bold;">extends</span> junit.<span style="color: #006633;">framework</span>.<span style="color: #006633;">TestCase</span> <span style="color: #009900;">&#123;</span>
  StringKeeper context<span style="color: #339933;">;</span>
  MessageHarness app<span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setUp<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    context <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> MapStringKeeper<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    app <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> MessageHarness<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> test404FromUnknownDestination<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">Exception</span> <span style="color: #009900;">&#123;</span>
    context.<span style="color: #006633;">put</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;destination&quot;</span>, <span style="color: #0000ff;">&quot;unknown@example.com&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    context.<span style="color: #006633;">put</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;text&quot;</span>, <span style="color: #0000ff;">&quot;hello from HTTP&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    app.<span style="color: #006633;">send</span><span style="color: #009900;">&#40;</span>context<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    assertEquals<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;404&quot;</span>, context.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span>HTTPConstants.<span style="color: #006633;">RESPONSE_CODE</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> test200FromKnownDestination<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">Exception</span> <span style="color: #009900;">&#123;</span>
    context.<span style="color: #006633;">put</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;destination&quot;</span>, <span style="color: #0000ff;">&quot;known@example.com&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    context.<span style="color: #006633;">put</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;text&quot;</span>, <span style="color: #0000ff;">&quot;hello from HTTP&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    app.<span style="color: #006633;">send</span><span style="color: #009900;">&#40;</span>context<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    assertEquals<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;200&quot;</span>, context.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span>HTTPConstants.<span style="color: #006633;">RESPONSE_CODE</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span></pre></div></div>

<p>I shall stop there, leaving the development of the rest of the application to interested readers.</p>
<p>From the above steps, I hope you can see that the normal process of Test-Driven Development is quite possible for both web applications, and web-application clients. When using a framework which gets all the fiddly stuff out of the way it can even be as simple, quick and productive as in-process development.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.punchbarrel.com/2009/01/07/test-driven-development-of-http-and-rest-interfaces-with-mojasef/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How much is really new?</title>
		<link>http://blog.punchbarrel.com/2008/12/11/how-much-is-really-new/</link>
		<comments>http://blog.punchbarrel.com/2008/12/11/how-much-is-really-new/#comments</comments>
		<pubDate>Thu, 11 Dec 2008 08:27:57 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[Information]]></category>
		<category><![CDATA[anthropology]]></category>
		<category><![CDATA[education]]></category>
		<category><![CDATA[insularity]]></category>
		<category><![CDATA[management]]></category>
		<category><![CDATA[sociology]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://blog.punchbarrel.com/?p=875</guid>
		<description><![CDATA[I read a lot of blogs and articles about education, software, and video. It&#8217;s often interesting to observe the differences and the similarities between these largely separate fields. In education, for example, the casual use of the internet for sharing and collaborating which characterises modern software development is seen as a new and contentious area [...]]]></description>
			<content:encoded><![CDATA[<p>I read a lot of blogs and articles about education, software, and video. It&#8217;s often interesting to observe the differences and the similarities between these largely separate fields. In education, for example, the casual use of the internet for sharing and collaborating which characterises modern software development is seen as a new and contentious area of exploration. When shown examples such as this it&#8217;s easy to become blasé and to assume that software practice is at the cutting edge of everything.</p>
<p>Ted Neward points out that this is surely not true, and give some examples where software teams have a lot to learn from other fields such as management, sociology and anthropology.</p>
<p><a href="http://blogs.tedneward.com/2008/12/10/The+Myth+Of+Discovery.aspx">Interoperability Happens &#8211; The Myth of Discovery</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.punchbarrel.com/2008/12/11/how-much-is-really-new/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Strategy is Something You Can Learn</title>
		<link>http://blog.punchbarrel.com/2008/12/04/strategy-is-something-you-can-learn/</link>
		<comments>http://blog.punchbarrel.com/2008/12/04/strategy-is-something-you-can-learn/#comments</comments>
		<pubDate>Thu, 04 Dec 2008 11:55:31 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[Information]]></category>
		<category><![CDATA[Atlassian]]></category>
		<category><![CDATA[business]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[startup]]></category>
		<category><![CDATA[strategy]]></category>

		<guid isPermaLink="false">http://blog.punchbarrel.com/?p=856</guid>
		<description><![CDATA[This is an inspiring article about ways to determine and implement business strategy. Best of all it&#8217;s in the context of starting and running a software business &#8211; in this case Mike Cannon-Brookes&#8217; Atlassian. This is going in to my &#8220;don&#8217;t forget&#8221; collection, with &#8220;6 reasons why a VC funded startup failed&#8221; rebelutionary: Strategy is [...]]]></description>
			<content:encoded><![CDATA[<p>This is an inspiring article about ways to determine and implement business strategy. Best of all it&#8217;s in the context of starting and running a software business &#8211; in this case Mike Cannon-Brookes&#8217; Atlassian.</p>
<p>This is going in to my &#8220;don&#8217;t forget&#8221; collection, with<br />
&#8220;<a href="http://blog.punchbarrel.com/2008/11/30/6-reasons-why-a-vc-funded-startup-failed/">6 reasons why a VC funded startup failed</a>&#8221;</p>
<p><a href="http://blogs.atlassian.com/rebelutionary/archives/2008/12/strategy_is_something_you_can_learn.html">rebelutionary: Strategy is Something You Can Learn</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.punchbarrel.com/2008/12/04/strategy-is-something-you-can-learn/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Software Craftsmanship 2009</title>
		<link>http://blog.punchbarrel.com/2008/12/01/software-craftsmanship-2009/</link>
		<comments>http://blog.punchbarrel.com/2008/12/01/software-craftsmanship-2009/#comments</comments>
		<pubDate>Mon, 01 Dec 2008 15:08:58 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[Information]]></category>
		<category><![CDATA[conference]]></category>
		<category><![CDATA[craft]]></category>
		<category><![CDATA[craftsmanship]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://blog.punchbarrel.com/?p=835</guid>
		<description><![CDATA[This looks like a really interesting conference. Now I&#8217;m thinking seriously about whether to put together a session and propose it&#8230; Software Craftsmanship 2009 &#8211; Home]]></description>
			<content:encoded><![CDATA[<p>This looks like a really interesting conference. Now I&#8217;m thinking seriously about whether to put together a session and propose it&#8230;</p>
<p><a href="http://parlezuml.com/softwarecraftsmanship/">Software Craftsmanship 2009 &#8211; Home</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.punchbarrel.com/2008/12/01/software-craftsmanship-2009/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What&#8217;s Missing From the Agile Manifesto</title>
		<link>http://blog.punchbarrel.com/2008/11/25/whats-missing-from-the-agile-manifesto/</link>
		<comments>http://blog.punchbarrel.com/2008/11/25/whats-missing-from-the-agile-manifesto/#comments</comments>
		<pubDate>Tue, 25 Nov 2008 10:08:11 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[Information]]></category>
		<category><![CDATA[agile]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[history]]></category>
		<category><![CDATA[manifesto]]></category>
		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://blog.punchbarrel.com/?p=817</guid>
		<description><![CDATA[An interesting summary of some thoughts on the agile manifesto, it&#8217;s place in software development history, and how/whether it should grow or change. InfoQ: Brian Marick: What&#8217;s Missing From the Agile Manifesto]]></description>
			<content:encoded><![CDATA[<p>An interesting summary of some thoughts on the agile manifesto, it&#8217;s place in software development history, and how/whether it should grow or change.</p>
<p><a href="http://www.infoq.com/news/2008/11/Marick-on-Agile-Manifesto">InfoQ: Brian Marick: What&#8217;s Missing From the Agile Manifesto</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.punchbarrel.com/2008/11/25/whats-missing-from-the-agile-manifesto/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 3.183 seconds -->

