<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments for Eric Lefevre-Ardant on Java &amp; Agile</title>
	<atom:link href="http://ericlefevre.net/wordpress/comments/feed/" rel="self" type="application/rss+xml" />
	<link>http://ericlefevre.net/wordpress</link>
	<description>Eric&#039;s Earnest Elucidations</description>
	<lastBuildDate>Wed, 08 Feb 2012 08:59:21 +0100</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
	<item>
		<title>Comment on Cleaning up test code by Peter Zsoldos</title>
		<link>http://ericlefevre.net/wordpress/2012/01/27/cleaning-up-test-code/comment-page-1/#comment-3395</link>
		<dc:creator>Peter Zsoldos</dc:creator>
		<pubDate>Wed, 08 Feb 2012 08:59:21 +0000</pubDate>
		<guid isPermaLink="false">http://ericlefevre.net/wordpress/?p=1028#comment-3395</guid>
		<description>Seems we have a somewhat different style for writing tests :)

In the first case, when I check the same thing for different input, I would either create a helper method
def assert_obtained_account_is_the_same_as_we_searched_for(self, account_number):
    self.assertEquals(account_number, self.service.get_customer_for(account_number).account_number)

and use that inside the test - simply to respect the single responsibility principle, and to remove the how from the test, so they can focus on the what

Could you elaborate why you consider the second case bad? E.g.: when asserting against an object&#039;s default values, I would write such tests and I don&#039;t consider it bad

P.S.: and sorry for accidentally writing the code in Python instead of Java :)</description>
		<content:encoded><![CDATA[<p>Seems we have a somewhat different style for writing tests :)</p>
<p>In the first case, when I check the same thing for different input, I would either create a helper method<br />
def assert_obtained_account_is_the_same_as_we_searched_for(self, account_number):<br />
    self.assertEquals(account_number, self.service.get_customer_for(account_number).account_number)</p>
<p>and use that inside the test &#8211; simply to respect the single responsibility principle, and to remove the how from the test, so they can focus on the what</p>
<p>Could you elaborate why you consider the second case bad? E.g.: when asserting against an object&#8217;s default values, I would write such tests and I don&#8217;t consider it bad</p>
<p>P.S.: and sorry for accidentally writing the code in Python instead of Java :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Cleaning up test code by Eric Lefevre-Ardant</title>
		<link>http://ericlefevre.net/wordpress/2012/01/27/cleaning-up-test-code/comment-page-1/#comment-3391</link>
		<dc:creator>Eric Lefevre-Ardant</dc:creator>
		<pubDate>Tue, 07 Feb 2012 14:13:15 +0000</pubDate>
		<guid isPermaLink="false">http://ericlefevre.net/wordpress/?p=1028#comment-3391</guid>
		<description>@Peter yes, I agree separating the setup from the assertion is useful... &lt;em&gt;when&lt;/em&gt; there are several asserts. Until then, I&#039;d rather keep my tests compact.
Also, I&#039;ve noticed that I shy away from having multiple asserts of that form. Often seems like having too many things tested at the same time (I do still have this kind of tests, but I am not happy with them).

I don&#039;t have a problem with having multiple simple asserts with inlined values, though.

So, for me, this is rather good:
&lt;code&gt;
public void can_obtain_a_customer_by_account_id() throws Exception {
  assertEquals(“ABC99&quot;, serviceImpl.getCustomer(“ABC99&quot;).getAccountId());
  assertEquals(“X&quot;, serviceImpl.getCustomer(“X&quot;).getAccountId());
  assertEquals(“1&quot;, serviceImpl.getCustomer(“1&quot;).getAccountId());
}
&lt;/code&gt;

While this is (a little) bad:
&lt;code&gt;
public void can_obtain_a_customer_by_account_id() throws Exception {
  Customer customer = serviceImpl.getCustomer(“ABC99&quot;);

  assertEquals(“ABC99&quot;, customer.getAccountId());
  assertEquals(“John&quot;, customer.getName());
}
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>@Peter yes, I agree separating the setup from the assertion is useful&#8230; <em>when</em> there are several asserts. Until then, I&#8217;d rather keep my tests compact.<br />
Also, I&#8217;ve noticed that I shy away from having multiple asserts of that form. Often seems like having too many things tested at the same time (I do still have this kind of tests, but I am not happy with them).</p>
<p>I don&#8217;t have a problem with having multiple simple asserts with inlined values, though.</p>
<p>So, for me, this is rather good:<br />
<code><br />
public void can_obtain_a_customer_by_account_id() throws Exception {<br />
  assertEquals(“ABC99", serviceImpl.getCustomer(“ABC99").getAccountId());<br />
  assertEquals(“X", serviceImpl.getCustomer(“X").getAccountId());<br />
  assertEquals(“1", serviceImpl.getCustomer(“1").getAccountId());<br />
}<br />
</code></p>
<p>While this is (a little) bad:<br />
<code><br />
public void can_obtain_a_customer_by_account_id() throws Exception {<br />
  Customer customer = serviceImpl.getCustomer(“ABC99");</p>
<p>  assertEquals(“ABC99", customer.getAccountId());<br />
  assertEquals(“John", customer.getName());<br />
}<br />
</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Cleaning up test code by Peter Zsoldos</title>
		<link>http://ericlefevre.net/wordpress/2012/01/27/cleaning-up-test-code/comment-page-1/#comment-3390</link>
		<dc:creator>Peter Zsoldos</dc:creator>
		<pubDate>Tue, 07 Feb 2012 10:58:01 +0000</pubDate>
		<guid isPermaLink="false">http://ericlefevre.net/wordpress/?p=1028#comment-3390</guid>
		<description>I&#039;ve found it useful to separate the Arrange, Act, and Assert parts 

@Test
public void can_obtain_a_customer_by_account_id() throws Exception {
   obtainedAccountId = serviceImpl.getCustomer(&quot;ABC99&quot;).getAccountId()

  assertEquals(&quot;ABC99&quot;, obtainedAccountId);
}

here, the Arrange part is in the setUp(Fixture), thus implicit. I know you don&#039;t like local variables, but it helps when there are multiple asserts (which might be of course a single logical assert) and you want to use plain JUnit and not introduce a new framework that has Facts/Observations).</description>
		<content:encoded><![CDATA[<p>I&#8217;ve found it useful to separate the Arrange, Act, and Assert parts </p>
<p>@Test<br />
public void can_obtain_a_customer_by_account_id() throws Exception {<br />
   obtainedAccountId = serviceImpl.getCustomer(&#8220;ABC99&#8243;).getAccountId()</p>
<p>  assertEquals(&#8220;ABC99&#8243;, obtainedAccountId);<br />
}</p>
<p>here, the Arrange part is in the setUp(Fixture), thus implicit. I know you don&#8217;t like local variables, but it helps when there are multiple asserts (which might be of course a single logical assert) and you want to use plain JUnit and not introduce a new framework that has Facts/Observations).</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Play Framework and Guice: use providers in Guice modules by Playframework + Google Guice (Español) &#171; Having fun with Play framework!</title>
		<link>http://ericlefevre.net/wordpress/2011/05/08/play-framework-and-guice-use-providers-in-guice-modules/comment-page-1/#comment-3384</link>
		<dc:creator>Playframework + Google Guice (Español) &#171; Having fun with Play framework!</dc:creator>
		<pubDate>Mon, 06 Feb 2012 03:41:12 +0000</pubDate>
		<guid isPermaLink="false">http://ericlefevre.net/wordpress/?p=923#comment-3384</guid>
		<description>[...] http://ericlefevre.net/wordpress/2011/05/08/play-framework-and-guice-use-providers-in-guice-modules/ [...]</description>
		<content:encoded><![CDATA[<p>[...] <a href="http://ericlefevre.net/wordpress/2011/05/08/play-framework-and-guice-use-providers-in-guice-modules/" rel="nofollow">http://ericlefevre.net/wordpress/2011/05/08/play-framework-and-guice-use-providers-in-guice-modules/</a> [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Java&#8217;s varargs are for unit tests by Eric Lefevre-Ardant</title>
		<link>http://ericlefevre.net/wordpress/2011/11/21/javas-varargs-are-for-unit-tests/comment-page-1/#comment-3376</link>
		<dc:creator>Eric Lefevre-Ardant</dc:creator>
		<pubDate>Fri, 03 Feb 2012 11:30:12 +0000</pubDate>
		<guid isPermaLink="false">http://ericlefevre.net/wordpress/?p=947#comment-3376</guid>
		<description>@David hm... I wouldn&#039;t be happy having tests depend on each other. I realize that tests within the same test class are definitely closely dependent on each other, because of these local builder methods, but I feel this is acceptable.
I wouldn&#039;t do that across multiple tests, though.
also, my builder methods tend to be fairly small (6 lines at the most), so it doesn&#039;t feel so bad having several of them.

Oh, another thing: I have found that I do not like to apply the same rules when writing test code and production code. Particularly, I do not believe that the DRY principle applies as much in test classes. However, the readability is a lot more important in the tests than it is in the production code.
Several people I&#039;ve talked to did seem to dislike this approach, though.</description>
		<content:encoded><![CDATA[<p>@David hm&#8230; I wouldn&#8217;t be happy having tests depend on each other. I realize that tests within the same test class are definitely closely dependent on each other, because of these local builder methods, but I feel this is acceptable.<br />
I wouldn&#8217;t do that across multiple tests, though.<br />
also, my builder methods tend to be fairly small (6 lines at the most), so it doesn&#8217;t feel so bad having several of them.</p>
<p>Oh, another thing: I have found that I do not like to apply the same rules when writing test code and production code. Particularly, I do not believe that the DRY principle applies as much in test classes. However, the readability is a lot more important in the tests than it is in the production code.<br />
Several people I&#8217;ve talked to did seem to dislike this approach, though.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on I avoid method variables in my test methods by Eric Lefevre-Ardant</title>
		<link>http://ericlefevre.net/wordpress/2011/11/24/i-avoid-method-variables-in-my-test-methods/comment-page-1/#comment-3375</link>
		<dc:creator>Eric Lefevre-Ardant</dc:creator>
		<pubDate>Fri, 03 Feb 2012 11:26:51 +0000</pubDate>
		<guid isPermaLink="false">http://ericlefevre.net/wordpress/?p=982#comment-3375</guid>
		<description>@David I agree with you in principle, but in practice I don&#039;t do that in my tests.
In the example you give, besides the point that I&#039;d rather inline the variables and get rid of the variable names altogether, I&#039;d probably name then like this:

  private Searcher searcherWithSomeValue = new Searcher( “some value” );
  private Searcher searcherWithSomeOtherValue = new Searcher( “some other value” );

I think this is mostly because I want my tests to read like little stories:

 assertThat(searcherWithSomeValue, not(is(searcherWithSomeOtherValue)));

I think the following feels less natural:

 assertThat(toTest, not(is(toCompare)));

However, in my production code, I would probably use names similar to the ones you suggest.</description>
		<content:encoded><![CDATA[<p>@David I agree with you in principle, but in practice I don&#8217;t do that in my tests.<br />
In the example you give, besides the point that I&#8217;d rather inline the variables and get rid of the variable names altogether, I&#8217;d probably name then like this:</p>
<p>  private Searcher searcherWithSomeValue = new Searcher( “some value” );<br />
  private Searcher searcherWithSomeOtherValue = new Searcher( “some other value” );</p>
<p>I think this is mostly because I want my tests to read like little stories:</p>
<p> assertThat(searcherWithSomeValue, not(is(searcherWithSomeOtherValue)));</p>
<p>I think the following feels less natural:</p>
<p> assertThat(toTest, not(is(toCompare)));</p>
<p>However, in my production code, I would probably use names similar to the ones you suggest.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Java&#8217;s varargs are for unit tests by David Wallace</title>
		<link>http://ericlefevre.net/wordpress/2011/11/21/javas-varargs-are-for-unit-tests/comment-page-1/#comment-3374</link>
		<dc:creator>David Wallace</dc:creator>
		<pubDate>Fri, 03 Feb 2012 11:23:41 +0000</pubDate>
		<guid isPermaLink="false">http://ericlefevre.net/wordpress/?p=947#comment-3374</guid>
		<description>Another great article, Eric.  

Just another idea about the class that the builder methods live in; and trying to do DRY.  My preference is to make such methods public and static, and put them in the test class for whichever type they are most closely related to.  In your example, they&#039;d be in the UserTest class.  Public is OK, since they only ever end up in the test version of the build, not the production build.  

That way, when I come to write any test class that does some building on the User class, I know that I&#039;m likely to find the builder method in UserTest.  So I put the right static import at the top of my test class, and end up with the same concise, readable code that you&#039;ve exhibited here.</description>
		<content:encoded><![CDATA[<p>Another great article, Eric.  </p>
<p>Just another idea about the class that the builder methods live in; and trying to do DRY.  My preference is to make such methods public and static, and put them in the test class for whichever type they are most closely related to.  In your example, they&#8217;d be in the UserTest class.  Public is OK, since they only ever end up in the test version of the build, not the production build.  </p>
<p>That way, when I come to write any test class that does some building on the User class, I know that I&#8217;m likely to find the builder method in UserTest.  So I put the right static import at the top of my test class, and end up with the same concise, readable code that you&#8217;ve exhibited here.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on I avoid method variables in my test methods by David Wallace</title>
		<link>http://ericlefevre.net/wordpress/2011/11/24/i-avoid-method-variables-in-my-test-methods/comment-page-1/#comment-3373</link>
		<dc:creator>David Wallace</dc:creator>
		<pubDate>Fri, 03 Feb 2012 11:11:59 +0000</pubDate>
		<guid isPermaLink="false">http://ericlefevre.net/wordpress/?p=982#comment-3373</guid>
		<description>Fantastic article.  I&#039;m glad I stumbled across your blog.

Just a minor point - whether &quot;searcher&quot; is a field or a local variable (and like you, I prefer it to be a field), there&#039;s no point in having a variable name which is just the same as the name of its type (minus the initial capital) - you may as well just call it x.  

In my opinion, a variable name should reflect what that variable is for.  This really helps to understand code when you come back to it several months later.  This idea applies to all code, of course; but in the case of unit tests, if the variable references the object to test, I prefer to call it toTest.  Then, if you need two Searcher objects for any reason (maybe you&#039;re testing equals() or compareTo()), then the second one could be toCompare.

private Searcher toTest = new Searcher( &quot;some value&quot; );
private Searcher toCompare = new Searcher( &quot;some other value&quot; );</description>
		<content:encoded><![CDATA[<p>Fantastic article.  I&#8217;m glad I stumbled across your blog.</p>
<p>Just a minor point &#8211; whether &#8220;searcher&#8221; is a field or a local variable (and like you, I prefer it to be a field), there&#8217;s no point in having a variable name which is just the same as the name of its type (minus the initial capital) &#8211; you may as well just call it x.  </p>
<p>In my opinion, a variable name should reflect what that variable is for.  This really helps to understand code when you come back to it several months later.  This idea applies to all code, of course; but in the case of unit tests, if the variable references the object to test, I prefer to call it toTest.  Then, if you need two Searcher objects for any reason (maybe you&#8217;re testing equals() or compareTo()), then the second one could be toCompare.</p>
<p>private Searcher toTest = new Searcher( &#8220;some value&#8221; );<br />
private Searcher toCompare = new Searcher( &#8220;some other value&#8221; );</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on How to use LogMeIn under Linux by Sebastian</title>
		<link>http://ericlefevre.net/wordpress/2010/07/30/how-to-use-logmein-under-linux/comment-page-1/#comment-3370</link>
		<dc:creator>Sebastian</dc:creator>
		<pubDate>Thu, 02 Feb 2012 14:09:53 +0000</pubDate>
		<guid isPermaLink="false">http://ericlefevre.net/wordpress/?p=846#comment-3370</guid>
		<description>At /var/lib/logmein-hamachi/h2-engine-override.cfg
you need to add both paths as in:
user1@host:~$ cat /var/lib/logmein-hamachi/h2-engine-override.cfg
Ipc.User     user1
Ipc.User     user1
.
.
.
.
Regards</description>
		<content:encoded><![CDATA[<p>At /var/lib/logmein-hamachi/h2-engine-override.cfg<br />
you need to add both paths as in:<br />
user1@host:~$ cat /var/lib/logmein-hamachi/h2-engine-override.cfg<br />
Ipc.User     user1<br />
Ipc.User     user1<br />
.<br />
.<br />
.<br />
.<br />
Regards</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on More data on productivity of small teams by MG</title>
		<link>http://ericlefevre.net/wordpress/2012/01/13/more-data-on-productivity-of-small-teams/comment-page-1/#comment-3356</link>
		<dc:creator>MG</dc:creator>
		<pubDate>Tue, 24 Jan 2012 18:43:00 +0000</pubDate>
		<guid isPermaLink="false">http://ericlefevre.net/wordpress/?p=1002#comment-3356</guid>
		<description>I once read somewhere that the C guy (must be Kerninghan or Ritchie) said that in a dev team, the quality of the code can not be better than the quality of the weakest developer. This is how I&#039;ve experienced things as well, small teams, specialised skills and you can hope for delivery. Lots of suits, lots of arms waving, lots of time wasted...</description>
		<content:encoded><![CDATA[<p>I once read somewhere that the C guy (must be Kerninghan or Ritchie) said that in a dev team, the quality of the code can not be better than the quality of the weakest developer. This is how I&#8217;ve experienced things as well, small teams, specialised skills and you can hope for delivery. Lots of suits, lots of arms waving, lots of time wasted&#8230;</p>
]]></content:encoded>
	</item>
</channel>
</rss>

