<?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 on: TDD: Testing collections</title>
	<atom:link href="http://www.markhneedham.com/blog/2010/07/28/tdd-testing-collections/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.markhneedham.com/blog/2010/07/28/tdd-testing-collections/</link>
	<description>Thoughts on Software Development</description>
	<lastBuildDate>Sat, 11 Feb 2012 23:17:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Philip Schwarz</title>
		<link>http://www.markhneedham.com/blog/2010/07/28/tdd-testing-collections/comment-page-1/#comment-43980</link>
		<dc:creator>Philip Schwarz</dc:creator>
		<pubDate>Sun, 08 Aug 2010 19:16:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=2765#comment-43980</guid>
		<description>Hi all,

in Java, using Hamcrest, it is possible to do the following:

List threes = Arrays.asList(3,3,3);
List oneTwoThree = Arrays.asList(1,2,3);
List noThrees = Arrays.asList(0,1,2);

assertThat(threes, everyItem(is(equalTo(3))));
assertThat(oneTwoThree,not(everyItem(is(equalTo(3))));
assertThat(noThrees, everyItem(is(not(equalTo(3)))));

although to get this to work we have to introduce the following method to deal with Generics issues

@SuppressWarnings(&quot;unchecked&quot;)
private Matcher equalTo(Integer i)
{   return(Matcher)org.hamcrest.Matchers.equalTo(i);
}</description>
		<content:encoded><![CDATA[<p>Hi all,</p>
<p>in Java, using Hamcrest, it is possible to do the following:</p>
<p>List threes = Arrays.asList(3,3,3);<br />
List oneTwoThree = Arrays.asList(1,2,3);<br />
List noThrees = Arrays.asList(0,1,2);</p>
<p>assertThat(threes, everyItem(is(equalTo(3))));<br />
assertThat(oneTwoThree,not(everyItem(is(equalTo(3))));<br />
assertThat(noThrees, everyItem(is(not(equalTo(3)))));</p>
<p>although to get this to work we have to introduce the following method to deal with Generics issues</p>
<p>@SuppressWarnings(&#8220;unchecked&#8221;)<br />
private Matcher equalTo(Integer i)<br />
{   return(Matcher)org.hamcrest.Matchers.equalTo(i);<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Esko Luontola</title>
		<link>http://www.markhneedham.com/blog/2010/07/28/tdd-testing-collections/comment-page-1/#comment-42822</link>
		<dc:creator>Esko Luontola</dc:creator>
		<pubDate>Thu, 29 Jul 2010 13:36:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=2765#comment-42822</guid>
		<description>I prefer that the testing framework provides assertions for checking whether the collection or array contains some values. There are six types of containment assertions which cover practically all of my use cases: contains, contains all, contains any, contains exactly, contains in order, contains in partial order. See for example http://www.jdave.org/documentation.html#containments (the first framework I used) and http://github.com/orfjackal/gospec/blob/release/examples/expectation_syntax_test.go#L73-90 (a framework I wrote).</description>
		<content:encoded><![CDATA[<p>I prefer that the testing framework provides assertions for checking whether the collection or array contains some values. There are six types of containment assertions which cover practically all of my use cases: contains, contains all, contains any, contains exactly, contains in order, contains in partial order. See for example <a href="http://www.jdave.org/documentation.html#containments" rel="nofollow">http://www.jdave.org/documentation.html#containments</a> (the first framework I used) and <a href="http://github.com/orfjackal/gospec/blob/release/examples/expectation_syntax_test.go#L73-90" rel="nofollow">http://github.com/orfjackal/gospec/blob/release/examples/expectation_syntax_test.go#L73-90</a> (a framework I wrote).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sudr</title>
		<link>http://www.markhneedham.com/blog/2010/07/28/tdd-testing-collections/comment-page-1/#comment-42666</link>
		<dc:creator>sudr</dc:creator>
		<pubDate>Wed, 28 Jul 2010 11:27:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=2765#comment-42666</guid>
		<description>Aren&#039;t we really asserting two different things
1. The collection is not empty
2. The elements in the collection are certain values

So shouldn&#039;t this then be two different tests. Though you would still have the one method that would still pass if the collection was empty.</description>
		<content:encoded><![CDATA[<p>Aren&#8217;t we really asserting two different things<br />
1. The collection is not empty<br />
2. The elements in the collection are certain values</p>
<p>So shouldn&#8217;t this then be two different tests. Though you would still have the one method that would still pass if the collection was empty.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Needham</title>
		<link>http://www.markhneedham.com/blog/2010/07/28/tdd-testing-collections/comment-page-1/#comment-42648</link>
		<dc:creator>Mark Needham</dc:creator>
		<pubDate>Wed, 28 Jul 2010 08:25:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=2765#comment-42648</guid>
		<description>Do frameworks in the world of Ruby allow you to have a test fail if there&#039;s no assertion? I haven&#039;t seen anything like that in the .NET world so far.</description>
		<content:encoded><![CDATA[<p>Do frameworks in the world of Ruby allow you to have a test fail if there&#8217;s no assertion? I haven&#8217;t seen anything like that in the .NET world so far.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sai Venkat</title>
		<link>http://www.markhneedham.com/blog/2010/07/28/tdd-testing-collections/comment-page-1/#comment-42644</link>
		<dc:creator>Sai Venkat</dc:creator>
		<pubDate>Wed, 28 Jul 2010 07:53:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=2765#comment-42644</guid>
		<description>Typically I would expect a test to fail if it ran with no assertion. Some kind of safety which we can get from the testing f/w we are using.

But still using the guard assertion before validation of the assertion makes the intent explicit :)

--Sai</description>
		<content:encoded><![CDATA[<p>Typically I would expect a test to fail if it ran with no assertion. Some kind of safety which we can get from the testing f/w we are using.</p>
<p>But still using the guard assertion before validation of the assertion makes the intent explicit <img src='http://www.markhneedham.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>&#8211;Sai</p>
]]></content:encoded>
	</item>
</channel>
</rss>

