<?xml version="1.0" encoding="utf-8"?>
<!-- generator="Movable Type/3.31" -->
<rss version="0.91">
  <channel>
    <title>Joe Walnes</title>
    <link>http://joe.truemesh.com/blog/</link>
    <description>Objects, adaptable and maintainable designs, agile, enterprise systems, XP, Java and .NET, blah blah.</description>
    <language>en-us</language>
    <webMaster>joe@truemesh.com</webMaster>
    <pubDate>Thu, 15 Jan 2009 23:38:04 +0000</pubDate>
    <item>
      <title>New blog: http://joewalnes.com</title>
      <link>http://joe.truemesh.com/blog//000752.html</link>
      <description><![CDATA[<p>So long, Moveable Type + SiteMesh solution running on my own crappy servers that I don't have time to look after.</p>

<p>Hello, Wordpress.com, with a lot less flexibility, but a system that someone else will look after.</p>

<p>My new blog home is <a href="http://joewalnes.com">http://joewalnes.com</a></p>
]]></description>
    </item>
    <item>
      <title>Creative uses of Hamcrest matchers</title>
      <link>http://joe.truemesh.com/blog//000705.html</link>
      <description><![CDATA[<p>The matcher API of <a href="http://code.google.com/p/hamcrest">Hamcrest</a> is typically associated with <a href="http://joe.truemesh.com/blog/000511.html">assertThat()</a> or <a href="http://www.jmock.org/matchers.html">mocks</a>. I always knew other people would find good uses for it, but I never really knew what.</p>

<p>I particularly like these:</p>

<h4>Collection processing</h4>

<p><a href="http://jroller.com/page/ghettoJedi?entry=using_hamcrest_for_iterators">H&aring;kan R&aring;berg</a> blogged about how Hamcrest can be used with iterators:</p>

<pre>
List&lt;Integer&gt; numbers = Arrays.asList(-1, 0, 1, 2);
List&lt;Integer&gt; positiveNumbers = detect(numbers, greaterThan(0)));
<!-- -->
List&lt;String&gt; words = Arrays.asList("cheese", "lemon", "spoon");
List&lt;String&gt; wordsWithoutE = reject(words, containingString("e"));
</pre>

<p>Nothing rocket-sciencey about it. But simple and useful because it reduces boilerplate code and get to use the ever growing library of Hamcrest matchers.</p>

<p>On top of that, combining Hamcrest with a <a href="http://cglib.sourceforge.net/">CGLib</a> generated proxy, he has built a staticly typed query API:</p>

<pre>
List&lt;Person&gt; employees = ...;
List&lt;Integer&gt; allAges 
        = collect(from(employees).getAge());
List&lt;Person&gt; allBosses 
        = collect(from(employees).getDepartment().getBoss());
List&lt;Person&gt; allAccountants
        = select(from(employees).getDepartment().getName(), 
                 containingString("Accounts"));
</pre>

<p>This is nice alternative to a string based query language as you get your IDE completions, refactoring, compile time checking etc, without the noise of boilerplate code. </p>

<h4>Web testing</h4>

<p><a href="http://chatley.com/blog/">Robert Chatley</a> has taken some of the concepts of his <a href="https://lift.dev.java.net/">LiFT</a> framework and reimplemented them using Hamcrest and <a href="http://code.google.com/p/webdriver">WebDriver</a> for performing web testing.</p>

<pre>
public void testHasLotsOfLinks() {
  goTo("http://some/url");
  assertPresenceOf(greaterThan(15), links());
  assertPresenceOf(atLeast(1), link().with(text(containingString("Sign in"))));
<!-- -->
  clickOn(link().with(text(containingString("Sign in"))));
  assertPresenceOf(exactly(1), title().with(text(equalTo("Sign in page"))));
}
</pre>

<p>Now initially this seems a bit wordy and strange. Robert has designed this as a <a href="http://chatley.com/blog/2006_05_01_archive.html">literate</a> API. If you adjust the syntax highlighting of your API and make the Java keywords and syntax less visible, you get this:</p>

<pre>
goTo "http://some/url"
assertPresenceOf greaterThan 15 links
assertPresenceOf atLeast 1 link with text containingString "Sign in"
<!-- -->
clickOn link with text containingString "Sign in"
assertPresenceOf exactly 1 title with text equalTo "Sign in page"
</pre>

<p>The motivation here is that the API usage is self documenting and could be useful to non-programmers. The flip-side to this is that it's actually quite hard to write APIs like this and the usage can take quite a bit of getting used to.</p>

<p>Robert also introduced a <code>Finder</code> interface (the <code>link()</code> and <code>title()</code> methods return <code>Finder</code> implementations). This allows you to factor out your own UI specific components:</p>

<pre>
assertPresenceOf(atLeast(1), signInLink());
clickOn(signInLink());
assertPresenceOf(exactly(1), 
  blogLink().with(urlParameter("name", containingString("joe"))));
</pre>

<p><i>This is the bit I really like.</i></p>

<p>Allowing abstractions of components and matching rules to be combined in many different ways, so tests can check exactly what they need to, resulting in reduced less brittle tests that are easier to maintain. </p>

<h4>Other uses</h4>

<p>As I hear of other uses I'm listing them on the <a href="http://code.google.com/p/hamcrest/wiki/UsesOfHamcrest">Hamcrest wiki</a>.</p>

<h4>When it goes bad</h4>

<p>Of course, like any technology, it's easy to get carried away.</p>

<p>Here's an example of Hamcrest gone bad:</p>

<pre>
assertThat(myNumber, <b>anyOf(equalTo(0), allOf(greaterThan(5), lessThan(10)))</b>);
</pre>

<p>I'm not a LISP programmer, so I find that really hard to understand. Just because we have an assertTHAT() method, we don't have to use it all the time. In this case it's much simpler to use plain old assertTRUE():</p>

<pre>
assertTrue("myNumber should be 0 or between 5 and 10", 
        <b>myNumber == 0 || (myNumber &gt; 5 && myNumber &lt; 10)</b>);
</pre>

<p>Even though the non-Matcher version is longer (it could be shortened by leaving out the message and using a shorter variable name, but that would make it harder to understand), I find it much easier to understand.</p>

<p>But, what if you actually <i>needed</i> to use a matcher (e.g. for the web testing or collection processing examples above)?</p>

<p>One approach is you could use higher level matcher that are composed of other matchers:</p>

<pre>
matcher = anyOf(equalTo(0), allOf(greaterThan(5), lessThan(10)))
// simplifies to
matcher = anyOf(equalTo(0), between(5, 10))
</pre>

<blockquote><i>Complete tangent:</i> An alternative to between(5, 10) is between(5).and(10). The latter makes for more literate code, but is harder to implement - again a design tradeoff.</blockquote>

<p>Another approach is to create a one-off anonymous matcher implementation:</p>

<pre>
matcher = new CustomMatcher<Integer>() {
  public boolean matchesSafely(Integer n) {
    return n == 0 || (n &gt; 5 && n &lt; 10);    
  }
}
</pre>

<p>What are you doing with Hamcrest?</p>

<h4>Updates:</h4>

<ol>
  <li><a href="http://junit.sourceforge.net/doc/ReleaseNotes4.4.html">JUnit 4.4</a> now comes with Hamcrest and assertThat().</li>
</ol>]]></description>
    </item>
    <item>
      <title>Hamcrest 1.1 released</title>
      <link>http://joe.truemesh.com/blog//000695.html</link>
      <description>http://code.google.com/p/hamcrest</description>
    </item>
    <item>
      <title>Testing on the Toilet</title>
      <link>http://joe.truemesh.com/blog//000667.html</link>
      <description><![CDATA[<p>At Google we have pretty good internal documentation, tutorials and places to find good tips. If you know you don't know something, it won't take long to find the answer.</p>

<p>However, it's slightly tougher to place something to be read, when the target readers don't know they don't know it. This was a problem the testing group were finding, as they wanted to improve sharing of practical testing techniques.</p>

<p>So, <b>Testing on the Toilet</b> was started. A regular weekly(ish) tip posted in toilet cubicles and above urinals. Short enough to be read whilst doing your business.</p>

<p>Soon after, <a href="http://www.flickr.com/photos/94264415@N00/237577001/">many</a> <a href="http://blog.arabx.com.au/?p=412">visitors</a> <a href="http://money.cnn.com/2007/01/05/magazines/fortune/Search_and_enjoy.fortune/index.htm">started</a> <a href="http://nat.truemesh.com/archives/000658.html">noticing</a> <a href="http://blogs.zdnet.com/micro-markets/?p=573">these</a> <a href="http://www.flickr.com/photos/niallkennedy/330227455/">postings</a> and we got requests to make these available to put up in offices of other development teams.</p>

<p>So, we have. </p>

<p><b><a href="http://googletesting.blogspot.com/">http://googletesting.blogspot.com/</a></b></p>

<p>Each episode will be made available as a toilet friendly PDF. </p>]]></description>
    </item>
    <item>
      <title>Building testable AJAX apps (Does my button look big in this?)</title>
      <link>http://joe.truemesh.com/blog//000649.html</link>
      <description><![CDATA[Last week, Adam Connors and I presented <b>"Does my button look big in this? Building testable AJAX applications."</b> at the Google London Test Automation Conference.

<ul><li>
<b><a href="http://video.google.com/videoplay?docid=4378663232897374824">Watch the video online</a></b> (approx 50 mins).</li></ul>

Unfortunately the code is unclear on the video, so you can also <a href="http://joe.truemesh.com/building-testable-ajax.ppt">download the slides</a> separately (13mb!). ]]></description>
    </item>
    <item>
      <title>QDox is back - 1.6 released</title>
      <link>http://joe.truemesh.com/blog//000642.html</link>
      <description><![CDATA[<h3>QDox history</h3>

<p><a href="http://qdox.codehaus.org">QDox</a> is a fast JavaDoc/Java parser built in 2002. It was originally intended as a stop gap until Java supported annotations by allowing tools to easily get access to JavaDoc attributes. Essentially it provided nothing more than a stripped down version of the JavaDoc Doclet tool, with performance suitable for using in continual build cycles (what would take JavaDoc over ten minutes to process would typically take QDox less than ten seconds). It served its purpose well.</p>

<h3>The death of QDox</h3>

<p>Then came along Java 5 and I stopped actively working on QDox. The first reason was that with the new annotations support, QDox wasn't necessary. The other reason was that it would take a lot of effort to update the parser to support Java 5 syntax (not just for annotations, but generics, enums, etc).</p>

<p>And so QDox went quiet. The dev team lost interest and the releases stopped.</p>

<h3>QDox is reborn</h3>

<p>It turned out, I was wrong. Even with Java supporting annotations, QDox in a Java 5 world has some benefits:<br />
<ul><br />
 <li>Some Java 5 projects still want to use JavaDoc attributes (as well as annotations). Maybe for legacy reasons.</li><br />
 <li>QDox acts on source code, rather than byte code. This can be useful in chicken and egg situations where you need to generate source from existing source, but you can't compile until you've generated the code.</li><br />
 <li>QDox exposes information that isn't exposed by reflection, such as <a href="http://paulhammant.com/blog/at-least-one-unilateral-improvement-to-java.html">names of parameters</a> or JavaDoc comments, which are useful for building tools to help visualize code.</li><br />
</ul></p>

<p>So, by popular demand, I'm resurrecting the project. Yay.</p>

<h3>1.6 released</h3>

<p>This new release is a stop-gap release. Highlights include:</p>

<ul>
 <li>Switched to Apache 2.0 license.</li>
 <li>Parser can now deal with Java 5 source code (annotations, generics, enums, var args, etc).</li>
 <li>Numerous bugfixes.</li>
</ul>

<p>This should be enough for existing projects to carry on using it with Java 5 code.</p>

<p>The next release will focus on making Java 5 specific features available in the API. Stay tuned.</p>

<ul>
<li><a href="http://qdox.codehaus.org/">http://qdox.codehaus.org/</a></li>
<li><a href="http://dist.codehaus.org/qdox/jars/qdox-1.6.jar">qdox-1.6.jar</a></li>
<li><a href="http://qdox.codehaus.org/usage.html">Getting started</a></li>
</ul>]]></description>
    </item>
    <item>
      <title>Java and .NET RESTful interoperability with XStream</title>
      <link>http://joe.truemesh.com/blog//000623.html</link>
      <description><![CDATA[<p>My ex-colleagues Paul Hammant and Ian Cartwright have written an article on their experiences of building <span class="caps">SOA </span>applications using <span class="caps">REST</span>ful services in .NET and Java that could interoperate over web services and message queues. <a href="http://xstream.codehaus.org/">XStream</a> made this possible.</p>

<p>Buzzwordtastic.</p>

<p><a href="http://www.infoq.com/articles/REST-INTEROP">http://www.infoq.com/articles/REST-INTEROP</a></p>]]></description>
    </item>
    <item>
      <title>I&apos;ve joined Google</title>
      <link>http://joe.truemesh.com/blog//000600.html</link>
      <description><![CDATA[<p>Woooo..... this looks fun.</p>]]></description>
    </item>
    <item>
      <title>OSCon: SiteMesh, SiteMesh, SiteMesh, SiteMesh</title>
      <link>http://joe.truemesh.com/blog//000524.html</link>
      <description><![CDATA[<p>Just got back from the <span class="caps">O'R</span>eilly Open Source Convention in Portland. Fantastic conference - met lots of really interesting people (and the odd nutter).</p>

<p>It was a good conference for <a href="http://www.opensymphony.com/sitemesh/">SiteMesh</a>. It opened my eyes to two things:</p>


<ol>
<li><b>SiteMesh rocks.</b> People who have tried SiteMesh, love it and don't turn back. Their preferred choice for web framework changes, but SiteMesh remains constant.</li>
<li><b>Our marketing sucks.</b> Despite it being around for 5 years, most of the Java web app community have never felt the need to try it.</li>
</ol>



<p>I was there to present a <a href="http://conferences.oreillynet.com/cs/os2005/view/e_sess/6828">session on SiteMesh</a> but a lot of other speakers beat me to it. It kept slipping into other sessions...</p>

<h4>Using AppFuse for Test driven Web Development, Matt Raible (<a href="http://conferences.oreillynet.com/cs/os2005/view/e_sess/7096">details</a>)</h4>

<p>Matt gave an overview of the technology stack used in his <a href="https://appfuse.dev.java.net/">AppFuse</a> application. Despite having 5 versions of his app that use different frameworks (Struts, WebWork, Tapestry, Spring <span class="caps">MVC </span>and JavaServer Faces), all used SiteMesh. Good!</p>

<h4>Integrate: Building a Site from Open Source Gems, Erik Hatcher (<a href="http://conferences.oreillynet.com/cs/os2005/view/e_sess/6401">details</a>)</h4>

<p>Erik walked us through the open source products he used to build his <a href="http://lucenebook.com/">Lucene Book</a> website and what customizations he made. The focus, of course, was <a href="http://lucene.apache.org/">Lucene</a> and I learned  a lot of great tricks about Lucene that hadn't occurred to me before - such as using "sounds like" queries with soundex and indexing images by colors. I continue to love Lucene.</p>

<p>A great point that Erik mentioned was the need to become intimate with the projects you use. If you truely want to make the most of your frameworks, understand how they work, join the community and extend them. </p>

<p>Erik chose Tapestry to build the site but he also had Blojsom and some static content, so SiteMesh was useful to integrate these and he created some custom code to build SiteMesh decorators with Tapestry.</p>

<p>He pointed out that despite submitting this useful Tapestry integration to the SiteMesh project, nothing had made it into the SiteMesh release. Feeling embarressed, I committed his changes immediately, inadvertently breaking the build and providing great ammunition for Eric Pugh's session on the <a href="http://conferences.oreillynet.com/cs/os2005/view/e_sess/6648">importance of continuous integration</a>.</p>

<h4>WebWork vs Spring <span class="caps">MVC</span> Smackdown, Matthew Porter and Matt Raible (<a href="http://conferences.oreillynet.com/cs/os2005/view/e_sess/6831">details</a>)</h4>

<p>The basic plot was this... Matthew Porter was arguing why Spring <span class="caps">MVC </span>sucks and WebWork rocks. Matt Raible was arguing why Spring <span class="caps">MVC </span>rocks and WebWork sucks. The only thing they both agreed on was SiteMesh rocked. A fairly heated and passionate debate - great fun to watch. I would have opted for more violence though. </p>

<p>Matthew Porter got the final laugh when he pointed out that he compared the Spring <span class="caps">MVC </span>and WebWork versions of Matt Raible's AppFuse framework and the Spring <span class="caps">MVC </span>version had about 25% (I think) more code, not including comments. </p>

<p>(<a href="http://raibledesigns.com/page/rd?anchor=oscon_spring_mvc_vs_webwork">more</a>)</p>

<h4>The Evolution of Web Application Architectures, Craig McClanahan (<a href="http://conferences.oreillynet.com/cs/os2005/view/e_sess/6478">details</a>)</h4>

<p>This was an interesting session where Craig compared the approaches taken by Struts, WebWork, Spring <span class="caps">MVC,</span> Tapestry and JavaServer Faces. He had done detailed research and, despite his heavy involvement with Struts and <span class="caps">JSF, </span>gave a very fair and objective view of the pros and cons of each.</p>

<p>This work could be useful for people evaluating which frameworks to choose and possibly could be overlayed with a guide based on values. The bottom line is there's no single 'ultimate' web framework and depending on your needs and values you should choose the most suitable. I think it would be beneficial to all to have a guide indicating which values each of these frameworks are suited/not-suited for.</p>

<p>So, my question is this: <b>Which values are more important to you when choosing a web framework and in which priority?</b></p>

<p>These are some example values that spring to mind: commercial support, testability (unit and functional), popularity, extensibility/customization, integration with other frameworks, rich widget support, <span class="caps">REST </span>friendlyness, simplicity vs magicness, <span class="caps">AJAX </span>friendlyness, learning curve, configuration, etc.</p>

<p>Anyhoo, SiteMesh was probably mentioned enough times to attract another load of people to the SiteMesh session.<br />
<hr /></p>

<p>I'm really glad these people mentioned SiteMesh and said such kind words about it - it resulted in a lot of interest and a full house for the SiteMesh session. I hope to get these presentations online shortly and write a bit more about how Subversion, Microsoft Word and SiteMesh can be combined to create a rich Content Management System.</p>

<h2>Improving SiteMesh's marketing</h2>

<p>The fact still remains that SiteMesh has terrible marketing. I'd love some ideas of how to spread the word more and encourage more people to try it but I honestly have no idea what to do. Any suggestions?</p>]]></description>
    </item>
    <item>
      <title>Flexible JUnit assertions with assertThat()</title>
      <link>http://joe.truemesh.com/blog//000511.html</link>
      <description><![CDATA[<p>Over time I've found I end up with a gazillion permutation of assertion methods in JUnit: assertEquals, assertNotEquals, assertStringContains, assertArraysEqual, assertInRange, assertIn, etc.</p>

<p>Here's a nicer way. <a href="http://jmock.org/">jMock</a> contains a <a href="http://jmock.org/docs/javadoc/org/jmock/core/constraint/package-frame.html">constraint library</a> for specifying precise expectations on mocks that can be reused in your own assertion method (and that's the last time I'm going to mention mocks today, I promise - despite the frequent references to the jMock library). </p>

<p>By making a simple JUnit assertion method that takes a <a href="http://jmock.org/docs/javadoc/org/jmock/core/Constraint.html">Constraint</a>, it provides a replacement for all the other assert methods.</p>

<p>I call mine <b><code>assertThat()</code></b> because I think it reads well. Combined with the jMock syntactic sugar, you can use it like this:</p>

<blockquote>

<pre>assertThat(something, eq(&quot;Hello&quot;));
assertThat(something, eq(true));
assertThat(something, isA(Color.class));
assertThat(something, contains(&quot;World&quot;));
assertThat(something, same(Food.CHEESE));
assertThat(something, NULL);
assertThat(something, NOT_NULL);</pre>

</blockquote>

<p>Okay, that's nice but nothing radical. A bunch of assert methods have been replaced with different methods that return constraint objects. But there's more...</p>

<h3>Combining constraints</h3>

<p>Constraints can be chained making it possible to combine them in different permutations. For instance, for virtually every assertion I do, I usually find that I need to test the negative equivalent at some point:</p>

<blockquote>

<pre>assertThat(something, not(eq(&quot;Hello&quot;)));
assertThat(something, not(contains(&quot;Cheese&quot;)));</pre>

</blockquote>

<p>Or maybe combinations of assertions:</p>

<blockquote>

<pre>assertThat(something, or(contains(&quot;color&quot;), contains(&quot;colour&quot;)));</pre>

</blockquote>

<h3>Readable failure messages</h3>

<p>The previous example can be written using the vanilla JUnit assert methods like this:</p>

<blockquote>

<pre>assertTrue(something.indexOf(&quot;color&quot;) &gt; -1 || something.indexOf(&quot;colour&quot;) &gt; -1);</pre>

</blockquote>

<p>Fine, the constraint based one is easier to read. But the <i>real beauty</i> is the failure message.</p>

<p>The vanilla JUnit assert fails with:</p>

<blockquote>

<pre>junit.framework.AssertionFailedError:</pre>

</blockquote>

<p>Useless! Means you have to put an explicit error message in the assertion:</p>

<blockquote>

<pre>assertTrue(something.indexOf(&quot;color&quot;) &gt; -1 || something.indexOf(&quot;colour&quot;) &gt; -1,
            &quot;Expected a string containing 'color' or 'colour'&quot;);</pre>

</blockquote>

<p>But the jMock constraint objects are self describing. So with this assertion:</p>

<blockquote>

<pre>assertThat(something, or(contains(&quot;color&quot;), contains(&quot;colour&quot;)));</pre>

</blockquote>

<p>I get this useful failure message, for free:</p>

<blockquote>

<pre>junit.framework.AssertionFailedError:
Expected: (a string containing &quot;color&quot; or a string containing &quot;colour&quot;)
but got : hello world</pre>

</blockquote>

<h3>Implementing it</h3>

<p>The simplest way is to <a href="http://jmock.org/download.html">grab</a> jMock and create your own base test class that extends <code>MockObjectTestCase</code>. This brings in <a href="http://jmock.org/docs/javadoc/org/jmock/core/MockObjectSupportTestCase.html">convenience methods</a> for free (I'm still not talking about mocks, honest). If you don't want to extend this class, you can easily reimplement these methods yourself - it's no biggie.</p>

<blockquote>

<pre>import org.jmock.MockObjectTestCase;
import org.jmock.core.Constraint;

public abstract class MyTestCase extends MockObjectTestCase {

  protected void assertThat(Object something, Constraint matches) {
    if (!matches.eval(something)) {
      StringBuffer message = new StringBuffer(&quot;\nExpected: &quot;);
      matches.describeTo(message);
      message.append(&quot;\nbut got : &quot;).append(something).append('\n');
      fail(message.toString());
    }
  }
  
}</pre>

</blockquote>

<p>Now ensure all your test cases extend this instead of <code>junit.framework.TestCase</code> and you're done.</p>

<h4>Defining custom constraints</h4>

<p>Creating new constraints is easy. Let's say I want something like:</p>

<blockquote>

<pre>assertThat(something, between(10, 20));</pre>

</blockquote>

<p>To do that I need to create a method that returns a Constraint object, requiring two methods; <code>eval()</code> for performing the actual assertion, and <code>describeTo()</code> for the self describing error message. This is something that can live in the base test class.</p>

<blockquote>

<pre>public Constraint between(final int min, final int max) {
  return new Constraint() {  
    public boolean eval(Object object) {
      if (!object instanceof Integer) {
        return false;
      }
      int value = ((Integer)object).intValue();
      return value &gt; min &amp;&amp; value &lt; max;
    }
    public StringBuffer describeTo(StringBuffer buffer) {
      return buffer.append(&quot;an int between &quot;).append(min).append(&quot; and &quot;).append(max);
    }
  }
}</pre>

</blockquote>

<p>This can be combined with other constraints and still generate decent failure messages.</p>

<blockquote>

<pre>assertThat(something, or(eq(50), between(10, 20));</pre>

</blockquote>

<blockquote>

<pre>junit.framework.AssertionFailedError:
Expected: (50 or an int between 10 and 20)
but got : 43</pre>

</blockquote>

<p>In practice I find I only need to create a few of these constraints as the different combinations gives me nearly everything I need.</p>

<p>More about this in the <a href="http://www.jmock.org/custom-constraints.html">jMock documentation</a>.</p>

<h4>Summary</h4>

<p>Since using this one assert method I've found my tests to be much easier to understand because of lack of noise and I've spent a lot less time creating 'yet another assertion' method for specific cases. And in <i>most</i> cases I never need to write a custom failure message as the failures are self describing. </p>

<h4>Updates</h4>

<ol>
 <li>The matchers from jMock have been pulled out into a new project, <a href="http://code.google.com/p/hamcrest">Hamcrest</a>.</li>
 <li>A <a href="http://joe.truemesh.com/blog/000705.html">follow up to this post</a> shows some creative uses of matchers, and talks a bit about when you shouldn't use them.</li>
 <li><a href="http://junit.sourceforge.net/doc/ReleaseNotes4.4.html">JUnit 4.4</a> now comes with assertThat()!</li>
</ol>]]></description>
    </item>
    <item>
      <title>SiteMesh and Content Management @ O&apos;Reilly OpenSource Conference</title>
      <link>http://joe.truemesh.com/blog//000510.html</link>
      <description><![CDATA[<p>I'm talking at the <span class="caps">O'R</span>eilly OpenSource Conference (OSCON) - Wednesday Aug 3, Portland, Oregon.</p>

<p>Come and say hi.</p>

<blockquote>
A problem faced in every web application is how to separate style from content. SiteMesh is a framework that provides an elegant solution to this, resulting in a clean separation that is straightforward to work with, complements other web frameworks, and is easily applied to existing applications.

<p>The first part of this session introduces SiteMesh, including an overview of the architecture and patterns, comparisons with other approaches, and how it can complement existing web frameworks (such as WebWork, Spring, and Struts).</p>

<p>The second part of this session demonstrates how SiteMesh can be blended with other technologies to form the foundation of a rich content management system that distinguishes between the specialized roles of users, their skills, and the most suitable tools. Content writers can use a word processor, web designers can use a <span class="caps">WYSIWYG </span>web development tool, and developers can use their <span class="caps">IDE.</span></p>

<p>Allowing these different roles and tools to come together to produce one website is a trivial task with SiteMesh--allowing content management to be easily introduced to existing applications. </p>

<p>Finally, some of the advanced features of SiteMesh are discussed, such as real world tips and tricks, how to create custom strategies for which look and feel to apply, assembling pages from components and building portal style applications. </p>

And for the first time, new features in SiteMesh 3 will be demonstrated, including extending the <span class="caps">HTML </span>processor, using it outside of SiteMesh, and offline support.<br />
</blockquote>

<p><a href="http://conferences.oreillynet.com/os2005/">http://conferences.oreillynet.com/os2005/</a></p>]]></description>
    </item>
    <item>
      <title>XStream 1.1.2 released. Java 5 Enums, JavaBeans, field aliasing, StAX, and more...</title>
      <link>http://joe.truemesh.com/blog//000508.html</link>
      <description><![CDATA[<p>New features:</p>

<ul>
<li>Java 5 Enum support.</li>
<li>JavaBeanConverter for serialization using getters and setters.</li>
<li>Aliasing of fields.</li>
<li>StAX integration, with namespaces.</li>
<li>Improved support on <span class="caps">JDK</span> 1.3 and <span class="caps">IBM JDK.</span></li>
</ul>

<p>
Changelog:<br />
<a href="http://xstream.codehaus.org/changes.html">http://xstream.codehaus.org/changes.html</a><br />
</p>

<p>
Full download:<br />
<a href="http://dist.codehaus.org/xstream/distributions/xstream-1.1.2.zip">http://dist.codehaus.org/xstream/distributions/xstream-1.1.2.zip</a><br />
</p>

<p>
Jar only:<br />
<a href="http://dist.codehaus.org/xstream/jars/xstream-1.1.2.jar">http://dist.codehaus.org/xstream/jars/xstream-1.1.2.jar</a><br />
</p>]]></description>
    </item>
    <item>
      <title>VB.Net is the bestest</title>
      <link>http://joe.truemesh.com/blog//000501.html</link>
      <description><![CDATA[<p>I was happily coding away in VB.Net today (grrr) when I noticed a little weirdity in the intellisense popup.</p>

<p><img alt="stupid.gif" src="http://joe.truemesh.com/blog/stupid.gif" width="691" height="226" border="0" /></p>

<p>Documentation says:</p>

<blockquote>
The NotOverridable modifier defines a method of a base class that cannot be overridden in derived classes. All methods are NotOverridable unless marked with the Overridable modifier. You can use the NotOverridable modifier when you do not want to allow an overridden method to be overridden again in a derived class.
</blockquote>

<p>Makes C++ look simple.</p>]]></description>
    </item>
    <item>
      <title>XStream 1.1.1 released</title>
      <link>http://joe.truemesh.com/blog//000496.html</link>
      <description><![CDATA[<p>I'm pleased to announce the release of <a href="http://xstream.codehaus.org"><b>XStream 1.1.1</b></a> - the powerful, yet easy to use Java to XML serialization library.</p>

<p>Some of the improvements in this release:<br />
<ul><br />
 <li>Converters can be registered with a priority, allowing more generic filters to handle classes that don't have more specific converters.</li><br />
 <li>Converters can now access underlying HierarchicalStreamReader/Writer implementations to make implementation specific calls.</li><br />
 <li>Improved support for classes using ObjectInputFields and ObjectInputValidation to follow the serialization specification.</li><br />
 <li>Default ClassLoader may be changed using XStream.setClassLoader().</li><br />
 <li>Loads of bugfixes and performance enhancements.</li><br />
</ul></p>

<p>Full change log: <a href="http://xstream.codehaus.org/changes.html">http://xstream.codehaus.org/changes.html</a><br />
Download: <a href="http://xstream.codehaus.org/download.html">http://xstream.codehaus.org/download.html</a></p>]]></description>
    </item>
    <item>
      <title>Accessing generic type information at runtime</title>
      <link>http://joe.truemesh.com/blog//000495.html</link>
      <description><![CDATA[<p>A common misconception about generics in Java 5 is that you can't access them at runtime.</p>

<p>What you can't find out at runtime is which generic type is associated with an instance of an object. However you can use reflection to look at which types have been staticly associated with a member of a class.</p>

<blockquote>

<pre>public class GenericsTest extends TestCase {

    class Thing {
        public Map&lt;String,Integer&gt; stuff;
    }

    public void test() throws Exception {
        Field field = Thing.class.getField(&quot;stuff&quot;);
        ParameterizedType type = (ParameterizedType) field.getGenericType();
        assertEquals(Map.class, type.getRawType());
        assertEquals(String.class, type.getActualTypeArguments()[0]);
        assertEquals(Integer.class, type.getActualTypeArguments()[1]);
    }

}</pre>

</blockquote>

<p>Just wanted to clear that up.</p>

<p>(This is something that I'll probably exploit in XStream for J5 users to further simplify the <span class="caps">XML.</span>)</p>]]></description>
    </item>

  </channel>
</rss>