<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<id>tag:www.nabble.com,2006:forum-2663</id>
	<title>Nabble - jMock</title>
	<updated>2008-10-04T20:27:43Z</updated>
	<link rel="self" type="application/atom+xml" href="http://www.nabble.com/jMock-f2663.xml" />
	<link rel="alternate" type="text/html" href="http://www.nabble.com/jMock-f2663.html" />
	<subtitle type="html">jMock is a library for testing Java code using mock objects1. Mock objects help you design and test the interactions between the objects in your programs. The jMock package makes it quick and easy to define mock objects, so you don't break the rhythm of programming; lets you define flexible constraints over object interactions, reducing the brittleness of your tests; is easy to extend. jMock home is &lt;a href=&quot;http://jmock.codehaus.org/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.</subtitle>
	
<entry>
	<id>tag:www.nabble.com,2006:post-19820420</id>
	<title>Re: how to test property of argument passed to method?</title>
	<published>2008-10-04T20:27:43Z</published>
	<updated>2008-10-04T20:27:43Z</updated>
	<author>
		<name>limbicsystem</name>
	</author>
	<content type="html">&lt;div dir=&quot;ltr&quot;&gt;&lt;div class=&quot;gmail_quote&quot;&gt;On Thu, Oct 2, 2008 at 5:38 PM, Dale King &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19820420&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;dalewking@...&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote:&lt;br&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;&quot;&gt;
&lt;div dir=&quot;ltr&quot;&gt;&lt;br&gt;Which could then be used as &lt;br&gt;&lt;br&gt;one(mock).myMethod( with(Bob.class, hasProperty(&amp;quot;prop&amp;quot;, equalTo(&amp;quot;value&amp;quot;) ) );&lt;/div&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;This is very close to what I was originally trying to do, and quite readable.&lt;/div&gt;
&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;L&lt;/div&gt;&lt;div&gt;&amp;nbsp;&lt;br&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/jMock---User-f2665.html&quot; embed=&quot;fixTarget[2665]&quot; target=&quot;_top&quot; &gt;jMock - User&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/how-to-test-property-of-argument-passed-to-method--tp19772768p19820420.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19788084</id>
	<title>Re: how to test property of argument passed to method?</title>
	<published>2008-10-02T14:38:08Z</published>
	<updated>2008-10-02T14:38:08Z</updated>
	<author>
		<name>Dale King-2</name>
	</author>
	<content type="html">&lt;div dir=&quot;ltr&quot;&gt;It sure seems like something could be done in the API to make it simpler, but I&amp;#39;m not sure what. So let me think out loud here.&lt;br&gt;&lt;br&gt;What we really want is the ability to explicitly specify the type parameter like in C++ where you could say&lt;br&gt;
&lt;br&gt;&amp;nbsp;with&amp;lt; Bob &amp;gt;( hasProperty(...) )&lt;br&gt;
&lt;br&gt;Java does have explicit type parameters for methods, but it only works if qualified with this for an instance method or the class name for static methods (See &amp;lt;&lt;a href=&quot;http://www.angelikalanger.com/GenericsFAQ/FAQSections/TechnicalDetails.html#What%20explicit%20type%20argument%20specification&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.angelikalanger.com/GenericsFAQ/FAQSections/TechnicalDetails.html#What%20explicit%20type%20argument%20specification&lt;/a&gt;?&amp;gt;). You would have to do something like this:&lt;br&gt;
&lt;br&gt;&amp;nbsp;this.&amp;lt; Bob &amp;gt;with( hasProperty(...) )&lt;br&gt;&lt;br&gt;It seems you could accomplish the same thing just using casting since with is going to return null any way:&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp; one(mock).myMethod( (Bob)with(hasProperty(&amp;quot;prop&amp;quot;, equalTo(&amp;quot;value&amp;quot;) ) );&lt;br&gt;
&lt;br&gt;I have said it before, but I think the generic parameter on Matcher was a bad idea and adds no value. At the very least there should have been non-generic matchers and generic ones are subinterface of that. hasProperty should return the non-generic Matcher while some other method could return a generic one. Then you can overload differently based on generic or non-generic.&lt;br&gt;
&lt;br&gt;Perhaps it might be good to have a with method that takes a class parameter (Note I used ... to allow multiple Matchers that are anded together):&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp; T with( Class&amp;lt;T&amp;gt; clazz, Matcher&amp;lt; ? &amp;gt;... matcher )&lt;br&gt;

&lt;br&gt;This is essentially the same as:&lt;br&gt;
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (T)with( allOf( is( clazz ), allOf( matcher ) ) ) );&lt;br&gt;&lt;br&gt;Which could then be used as &lt;br&gt;&lt;br&gt;one(mock).myMethod( with(Bob.class, hasProperty(&amp;quot;prop&amp;quot;, equalTo(&amp;quot;value&amp;quot;) ) );&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;div class=&quot;gmail_quote&quot;&gt;
On Thu, Oct 2, 2008 at 3:54 PM, Limbic System &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19788084&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;limbicsystem@...&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote:&lt;br&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;
&lt;div dir=&quot;ltr&quot;&gt;Nat,&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Thanks for your speedy reply. &amp;nbsp;Too bad the generics don&amp;#39;t allow that syntax, but at least now I can stop banging my head against the desk. :-)&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;font color=&quot;#888888&quot;&gt;&lt;div&gt;
L&lt;/div&gt;&lt;/font&gt;&lt;div&gt;&lt;div&gt;&lt;/div&gt;&lt;div class=&quot;Wj3C7c&quot;&gt;&lt;div&gt;
&lt;br&gt;&lt;div class=&quot;gmail_quote&quot;&gt;On Thu, Oct 2, 2008 at 1:37 AM, Nat Pryce &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19788084&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;nat.pryce@...&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote:&lt;br&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;

Unfortunately, Java&amp;#39;s generics are crap, so while the following doesn&amp;#39;t compile:&lt;br&gt;
&lt;div&gt;&lt;br&gt;
 &amp;nbsp; &amp;nbsp;one(mock).myMethod(with(hasProperty(&amp;quot;prop&amp;quot;, eq(&amp;quot;value&amp;quot;))));&lt;br&gt;
&lt;br&gt;
&lt;/div&gt;The following does:&lt;br&gt;
&lt;br&gt;
 &amp;nbsp; &amp;nbsp;Matcher&amp;lt;Bob&amp;gt; propEqualToValue = hasProperty(&amp;quot;prop&amp;quot;, equalTo(&amp;quot;value&amp;quot;);&lt;br&gt;
 &amp;nbsp; &amp;nbsp;one(mock).myMethod(with(propEqualToValue));&lt;br&gt;
&lt;br&gt;
Maybe they&amp;#39;ll make generics work one day, but until then we&amp;#39;ll have to&lt;br&gt;
use awkward workarounds like that.&lt;br&gt;
&lt;br&gt;
--Nat&lt;br&gt;
&lt;br&gt;
2008/10/2 Limbic System &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19788084&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;limbicsystem@...&lt;/a&gt;&amp;gt;:&lt;br&gt;
&lt;div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&amp;gt; What is the proper way to test a property of an argument passed into a&lt;br&gt;
&amp;gt; method of a mock, under JMock 2.5?&lt;br&gt;
&amp;gt; Let&amp;#39;s say that my CUT would normally be called like:&lt;br&gt;
&amp;gt; &amp;nbsp; &amp;nbsp;myObject.myMethod(arg);&lt;br&gt;
&amp;gt; and I&amp;#39;d like to verify that &amp;quot;arg&amp;quot; is of a particular type, and that it has a&lt;br&gt;
&amp;gt; particular property set. &amp;nbsp;I&amp;#39;m trying to do this:&lt;br&gt;
&amp;gt; &amp;nbsp; &amp;nbsp;one(mock).myMethod(with(hasProperty(&amp;quot;prop&amp;quot;, eq(&amp;quot;value&amp;quot;))));&lt;br&gt;
&amp;gt; but hasProperty() returns Object, while myMethod() is expecting type&lt;br&gt;
&amp;gt; Argument.&lt;br&gt;
&amp;gt; I *can* do the following, which works:&lt;br&gt;
&amp;gt; &amp;nbsp; &amp;nbsp;one(mock).myMethod(with(any(Argument.class)));&lt;br&gt;
&amp;gt; I&amp;#39;ve been googling this problem for 2 days now, so any help would be greatly&lt;br&gt;
&amp;gt; appreciated, thanks.&lt;br&gt;
&amp;gt;&lt;br&gt;
&lt;br&gt;
&lt;/div&gt;&lt;/div&gt;---------------------------------------------------------------------&lt;br&gt;
To unsubscribe from this list, please visit:&lt;br&gt;
&lt;br&gt;
 &amp;nbsp; &amp;nbsp;&lt;a href=&quot;http://xircles.codehaus.org/manage_email&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;http://xircles.codehaus.org/manage_email&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;/blockquote&gt;&lt;/div&gt;&lt;br&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;
&lt;/blockquote&gt;&lt;/div&gt;&lt;br&gt;&lt;br clear=&quot;all&quot;&gt;&lt;br&gt;-- &lt;br&gt;Dale King&lt;br&gt;
&lt;/div&gt;
&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/jMock---User-f2665.html&quot; embed=&quot;fixTarget[2665]&quot; target=&quot;_top&quot; &gt;jMock - User&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/how-to-test-property-of-argument-passed-to-method--tp19772768p19788084.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19786470</id>
	<title>Re: how to test property of argument passed to method?</title>
	<published>2008-10-02T12:54:43Z</published>
	<updated>2008-10-02T12:54:43Z</updated>
	<author>
		<name>limbicsystem</name>
	</author>
	<content type="html">&lt;div dir=&quot;ltr&quot;&gt;Nat,&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Thanks for your speedy reply. &amp;nbsp;Too bad the generics don&amp;#39;t allow that syntax, but at least now I can stop banging my head against the desk. :-)&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;L&lt;/div&gt;&lt;div&gt;
&lt;br&gt;&lt;div class=&quot;gmail_quote&quot;&gt;On Thu, Oct 2, 2008 at 1:37 AM, Nat Pryce &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19786470&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;nat.pryce@...&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote:&lt;br&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;&quot;&gt;
Unfortunately, Java&amp;#39;s generics are crap, so while the following doesn&amp;#39;t compile:&lt;br&gt;
&lt;div class=&quot;Ih2E3d&quot;&gt;&lt;br&gt;
 &amp;nbsp; &amp;nbsp;one(mock).myMethod(with(hasProperty(&amp;quot;prop&amp;quot;, eq(&amp;quot;value&amp;quot;))));&lt;br&gt;
&lt;br&gt;
&lt;/div&gt;The following does:&lt;br&gt;
&lt;br&gt;
 &amp;nbsp; &amp;nbsp;Matcher&amp;lt;Bob&amp;gt; propEqualToValue = hasProperty(&amp;quot;prop&amp;quot;, equalTo(&amp;quot;value&amp;quot;);&lt;br&gt;
 &amp;nbsp; &amp;nbsp;one(mock).myMethod(with(propEqualToValue));&lt;br&gt;
&lt;br&gt;
Maybe they&amp;#39;ll make generics work one day, but until then we&amp;#39;ll have to&lt;br&gt;
use awkward workarounds like that.&lt;br&gt;
&lt;br&gt;
--Nat&lt;br&gt;
&lt;br&gt;
2008/10/2 Limbic System &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19786470&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;limbicsystem@...&lt;/a&gt;&amp;gt;:&lt;br&gt;
&lt;div&gt;&lt;div&gt;&lt;/div&gt;&lt;div class=&quot;Wj3C7c&quot;&gt;&amp;gt; What is the proper way to test a property of an argument passed into a&lt;br&gt;
&amp;gt; method of a mock, under JMock 2.5?&lt;br&gt;
&amp;gt; Let&amp;#39;s say that my CUT would normally be called like:&lt;br&gt;
&amp;gt; &amp;nbsp; &amp;nbsp;myObject.myMethod(arg);&lt;br&gt;
&amp;gt; and I&amp;#39;d like to verify that &amp;quot;arg&amp;quot; is of a particular type, and that it has a&lt;br&gt;
&amp;gt; particular property set. &amp;nbsp;I&amp;#39;m trying to do this:&lt;br&gt;
&amp;gt; &amp;nbsp; &amp;nbsp;one(mock).myMethod(with(hasProperty(&amp;quot;prop&amp;quot;, eq(&amp;quot;value&amp;quot;))));&lt;br&gt;
&amp;gt; but hasProperty() returns Object, while myMethod() is expecting type&lt;br&gt;
&amp;gt; Argument.&lt;br&gt;
&amp;gt; I *can* do the following, which works:&lt;br&gt;
&amp;gt; &amp;nbsp; &amp;nbsp;one(mock).myMethod(with(any(Argument.class)));&lt;br&gt;
&amp;gt; I&amp;#39;ve been googling this problem for 2 days now, so any help would be greatly&lt;br&gt;
&amp;gt; appreciated, thanks.&lt;br&gt;
&amp;gt;&lt;br&gt;
&lt;br&gt;
&lt;/div&gt;&lt;/div&gt;---------------------------------------------------------------------&lt;br&gt;
To unsubscribe from this list, please visit:&lt;br&gt;
&lt;br&gt;
 &amp;nbsp; &amp;nbsp;&lt;a href=&quot;http://xircles.codehaus.org/manage_email&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;http://xircles.codehaus.org/manage_email&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;/blockquote&gt;&lt;/div&gt;&lt;br&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/jMock---User-f2665.html&quot; embed=&quot;fixTarget[2665]&quot; target=&quot;_top&quot; &gt;jMock - User&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/how-to-test-property-of-argument-passed-to-method--tp19772768p19786470.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19773677</id>
	<title>Re: how to test property of argument passed to method?</title>
	<published>2008-10-01T22:37:56Z</published>
	<updated>2008-10-01T22:37:56Z</updated>
	<author>
		<name>Nat Pryce</name>
	</author>
	<content type="html">Unfortunately, Java's generics are crap, so while the following doesn't compile:
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; one(mock).myMethod(with(hasProperty(&amp;quot;prop&amp;quot;, eq(&amp;quot;value&amp;quot;))));
&lt;br&gt;&lt;br&gt;The following does:
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; Matcher&amp;lt;Bob&amp;gt; propEqualToValue = hasProperty(&amp;quot;prop&amp;quot;, equalTo(&amp;quot;value&amp;quot;);
&lt;br&gt;&amp;nbsp; &amp;nbsp; one(mock).myMethod(with(propEqualToValue));
&lt;br&gt;&lt;br&gt;Maybe they'll make generics work one day, but until then we'll have to
&lt;br&gt;use awkward workarounds like that.
&lt;br&gt;&lt;br&gt;--Nat
&lt;br&gt;&lt;br&gt;2008/10/2 Limbic System &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19773677&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;limbicsystem@...&lt;/a&gt;&amp;gt;:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; What is the proper way to test a property of an argument passed into a
&lt;br&gt;&amp;gt; method of a mock, under JMock 2.5?
&lt;br&gt;&amp;gt; Let's say that my CUT would normally be called like:
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;myObject.myMethod(arg);
&lt;br&gt;&amp;gt; and I'd like to verify that &amp;quot;arg&amp;quot; is of a particular type, and that it has a
&lt;br&gt;&amp;gt; particular property set. &amp;nbsp;I'm trying to do this:
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;one(mock).myMethod(with(hasProperty(&amp;quot;prop&amp;quot;, eq(&amp;quot;value&amp;quot;))));
&lt;br&gt;&amp;gt; but hasProperty() returns Object, while myMethod() is expecting type
&lt;br&gt;&amp;gt; Argument.
&lt;br&gt;&amp;gt; I *can* do the following, which works:
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;one(mock).myMethod(with(any(Argument.class)));
&lt;br&gt;&amp;gt; I've been googling this problem for 2 days now, so any help would be greatly
&lt;br&gt;&amp;gt; appreciated, thanks.
&lt;br&gt;&amp;gt;
&lt;/div&gt;&lt;br&gt;---------------------------------------------------------------------
&lt;br&gt;To unsubscribe from this list, please visit:
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://xircles.codehaus.org/manage_email&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://xircles.codehaus.org/manage_email&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/jMock---User-f2665.html&quot; embed=&quot;fixTarget[2665]&quot; target=&quot;_top&quot; &gt;jMock - User&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/how-to-test-property-of-argument-passed-to-method--tp19772768p19773677.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19772768</id>
	<title>how to test property of argument passed to method?</title>
	<published>2008-10-01T20:19:19Z</published>
	<updated>2008-10-01T20:19:19Z</updated>
	<author>
		<name>limbicsystem</name>
	</author>
	<content type="html">&lt;div dir=&quot;ltr&quot;&gt;&lt;div&gt;What is the proper way to test a property of an argument passed into a method of a mock, under JMock 2.5?&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Let&amp;#39;s say that my CUT would normally be called like:&lt;/div&gt;&lt;div&gt;&lt;br&gt;
&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; myObject.myMethod(arg);&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;and I&amp;#39;d like to verify that &amp;quot;arg&amp;quot; is of a particular type, and that it has a particular property set. &amp;nbsp;I&amp;#39;m trying to do this:&lt;/div&gt;&lt;div&gt;&lt;br&gt;
&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; one(mock).myMethod(with(hasProperty(&amp;quot;prop&amp;quot;, eq(&amp;quot;value&amp;quot;))));&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;but hasProperty() returns Object, while myMethod() is expecting type Argument.&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;
I *can* do the following, which works:&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; one(mock).myMethod(with(any(Argument.class)));&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;I&amp;#39;ve been googling this problem for 2 days now, so any help would be greatly appreciated, thanks.&lt;/div&gt;
&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/jMock---User-f2665.html&quot; embed=&quot;fixTarget[2665]&quot; target=&quot;_top&quot; &gt;jMock - User&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/how-to-test-property-of-argument-passed-to-method--tp19772768p19772768.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19566921</id>
	<title>Re: &quot;java.lang.IllegalArgumentException: a mock with name ... already exists&quot; with jmock2.5.0</title>
	<published>2008-09-18T23:23:05Z</published>
	<updated>2008-09-18T23:23:05Z</updated>
	<author>
		<name>Steve Freeman-2</name>
	</author>
	<content type="html">It looks like the context is hanging on to both collectors, which &amp;nbsp;
&lt;br&gt;would mean that they need a name. What's happening around these tests? &amp;nbsp;
&lt;br&gt;How do you manage your context object?
&lt;br&gt;&lt;br&gt;S.
&lt;br&gt;&lt;br&gt;On 19 Sep 2008, at 02:42, 王軍＠Neusoft wrote:
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Hi
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I got a problem with jmock2.5.0.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Below is my tests that past under jmock2.2.0. After upgrading jmock to
&lt;br&gt;&amp;gt; 2.5.0, these tests got failed with the stack trace below.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;@Test
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;public void testCollectMissDataRight() throws Exception {
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;final Collector &amp;nbsp;collector0 = context.mock(Collector.class);
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;final SocketSession fSession = &amp;nbsp;
&lt;br&gt;&amp;gt; context.mock(SocketSession.class);
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;MaintenanceSession session =
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;new MaintenanceSession(null,collector0);
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;context.checking(new Expectations() {
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&lt;br&gt;&amp;gt; one(collector0).isConnectedSector(with(equal(&amp;quot;TACC00&amp;quot;)));
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;will(returnValue(fSession));
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&lt;br&gt;&amp;gt; one(fSession).startCollectLeftData((byte[])with(anything()));
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;});
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;byte[] data = &amp;quot;0000004820000001234567890123456789012345678999
&lt;br&gt;&amp;gt; TACC00 &amp;nbsp;&amp;quot;.getBytes();
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;session.processData(data);
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;context.assertIsSatisfied();
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;}
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;@Test
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;public void testCollectMissDataWrong() throws Exception {
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;final Collector &amp;nbsp;collector1 = context.mock(Collector.class);
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;final SocketSession fSession1 = &amp;nbsp;
&lt;br&gt;&amp;gt; context.mock(SocketSession.class);
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;MaintenanceSession session =
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;new MaintenanceSession(null,collector1);
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;context.checking(new Expectations() {
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&lt;br&gt;&amp;gt; one(collector1).isConnectedSector(with(equal(&amp;quot;TACC00&amp;quot;)));
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;will(returnValue(null));
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&lt;br&gt;&amp;gt; never(fSession1).startCollectLeftData((byte[])with(anything()));
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&lt;br&gt;&amp;gt; one(collector1).processAPError((String)with(anything()));
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;});
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;byte[] data = &amp;quot;0000004820000001234567890123456789012345678999
&lt;br&gt;&amp;gt; TACC00 &amp;nbsp;&amp;quot;.getBytes();
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;session.processData(data);
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;context.assertIsSatisfied();
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;}
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; java.lang.IllegalArgumentException: a mock with name collector already
&lt;br&gt;&amp;gt; exists
&lt;br&gt;&amp;gt; at org.jmock.Mockery.mock(Mockery.java:128)
&lt;br&gt;&amp;gt; at org.jmock.Mockery.mock(Mockery.java:120)
&lt;br&gt;&amp;gt; at
&lt;br&gt;&amp;gt; rae07a 
&lt;br&gt;&amp;gt; .collect 
&lt;br&gt;&amp;gt; .MaintenanceSessionTest 
&lt;br&gt;&amp;gt; .testCollectMissDataWrong(MaintenanceSessionTest.java:45)
&lt;br&gt;&amp;gt; at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
&lt;br&gt;&amp;gt; at
&lt;br&gt;&amp;gt; sun 
&lt;br&gt;&amp;gt; .reflect 
&lt;br&gt;&amp;gt; .NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
&lt;br&gt;&amp;gt; at
&lt;br&gt;&amp;gt; sun 
&lt;br&gt;&amp;gt; .reflect 
&lt;br&gt;&amp;gt; .DelegatingMethodAccessorImpl 
&lt;br&gt;&amp;gt; .invoke(DelegatingMethodAccessorImpl.java:25)
&lt;br&gt;&amp;gt; at java.lang.reflect.Method.invoke(Method.java:585)
&lt;br&gt;&amp;gt; at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:59)
&lt;br&gt;&amp;gt; at
&lt;br&gt;&amp;gt; org 
&lt;br&gt;&amp;gt; .junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java: 
&lt;br&gt;&amp;gt; 98)
&lt;br&gt;&amp;gt; at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79)
&lt;br&gt;&amp;gt; at
&lt;br&gt;&amp;gt; org 
&lt;br&gt;&amp;gt; .junit 
&lt;br&gt;&amp;gt; .internal 
&lt;br&gt;&amp;gt; .runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java: 
&lt;br&gt;&amp;gt; 87)
&lt;br&gt;&amp;gt; at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java: 
&lt;br&gt;&amp;gt; 77)
&lt;br&gt;&amp;gt; at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42)
&lt;br&gt;&amp;gt; at
&lt;br&gt;&amp;gt; org 
&lt;br&gt;&amp;gt; .junit 
&lt;br&gt;&amp;gt; .internal 
&lt;br&gt;&amp;gt; .runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:88)
&lt;br&gt;&amp;gt; at
&lt;br&gt;&amp;gt; org 
&lt;br&gt;&amp;gt; .junit 
&lt;br&gt;&amp;gt; .internal 
&lt;br&gt;&amp;gt; .runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
&lt;br&gt;&amp;gt; at
&lt;br&gt;&amp;gt; org.junit.internal.runners.JUnit4ClassRunner 
&lt;br&gt;&amp;gt; $1.run(JUnit4ClassRunner.java:44)
&lt;br&gt;&amp;gt; at
&lt;br&gt;&amp;gt; org 
&lt;br&gt;&amp;gt; .junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java: 
&lt;br&gt;&amp;gt; 27)
&lt;br&gt;&amp;gt; at &amp;nbsp;
&lt;br&gt;&amp;gt; org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java: 
&lt;br&gt;&amp;gt; 37)
&lt;br&gt;&amp;gt; at
&lt;br&gt;&amp;gt; org 
&lt;br&gt;&amp;gt; .junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java: 
&lt;br&gt;&amp;gt; 42)
&lt;br&gt;&amp;gt; at
&lt;br&gt;&amp;gt; org 
&lt;br&gt;&amp;gt; .eclipse 
&lt;br&gt;&amp;gt; .jdt 
&lt;br&gt;&amp;gt; .internal 
&lt;br&gt;&amp;gt; .junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
&lt;br&gt;&amp;gt; at
&lt;br&gt;&amp;gt; org 
&lt;br&gt;&amp;gt; .eclipse 
&lt;br&gt;&amp;gt; .jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
&lt;br&gt;&amp;gt; at
&lt;br&gt;&amp;gt; org 
&lt;br&gt;&amp;gt; .eclipse 
&lt;br&gt;&amp;gt; .jdt 
&lt;br&gt;&amp;gt; .internal 
&lt;br&gt;&amp;gt; .junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
&lt;br&gt;&amp;gt; at
&lt;br&gt;&amp;gt; org 
&lt;br&gt;&amp;gt; .eclipse 
&lt;br&gt;&amp;gt; .jdt 
&lt;br&gt;&amp;gt; .internal 
&lt;br&gt;&amp;gt; .junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
&lt;br&gt;&amp;gt; at
&lt;br&gt;&amp;gt; org 
&lt;br&gt;&amp;gt; .eclipse 
&lt;br&gt;&amp;gt; .jdt 
&lt;br&gt;&amp;gt; .internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
&lt;br&gt;&amp;gt; at
&lt;br&gt;&amp;gt; org 
&lt;br&gt;&amp;gt; .eclipse 
&lt;br&gt;&amp;gt; .jdt 
&lt;br&gt;&amp;gt; .internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java: 
&lt;br&gt;&amp;gt; 196)
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I got into jmock2.50 source and found out this problem has something &amp;nbsp;
&lt;br&gt;&amp;gt; to do
&lt;br&gt;&amp;gt; with defaultNameFor method which always gives the same name for the &amp;nbsp;
&lt;br&gt;&amp;gt; same
&lt;br&gt;&amp;gt; class.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;public &amp;lt;T&amp;gt; T mock(Class&amp;lt;T&amp;gt; typeToMock) {
&lt;br&gt;&amp;gt; &amp;nbsp;return mock(typeToMock, namingScheme.defaultNameFor(typeToMock));
&lt;br&gt;&amp;gt; }
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Maybe this is supposed to do. Can anybody help me with some answer?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; James
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; ----------------------------------------------------------------------------------------------
&lt;br&gt;&amp;gt; Confidentiality Notice: The information contained in this e-mail and &amp;nbsp;
&lt;br&gt;&amp;gt; any
&lt;br&gt;&amp;gt; accompanying attachment(s) is intended only for the use of the &amp;nbsp;
&lt;br&gt;&amp;gt; intended
&lt;br&gt;&amp;gt; recipient and may be confidential and/or privileged of Neusoft &amp;nbsp;
&lt;br&gt;&amp;gt; Corporation, its subsidiaries and/or its affiliates. If any reader &amp;nbsp;
&lt;br&gt;&amp;gt; of this communication is not the intended recipient, unauthorized &amp;nbsp;
&lt;br&gt;&amp;gt; use, forwarding, printing, storing, disclosure or copying is &amp;nbsp;
&lt;br&gt;&amp;gt; strictly prohibited, and may be unlawful. If you have received this &amp;nbsp;
&lt;br&gt;&amp;gt; communication in error, please immediately notify the sender by &amp;nbsp;
&lt;br&gt;&amp;gt; return e-mail, and delete the original message and all copies from &amp;nbsp;
&lt;br&gt;&amp;gt; your system. Thank you.
&lt;br&gt;&amp;gt; -----------------------------------------------------------------------------------------------
&lt;br&gt;&amp;gt;
&lt;/div&gt;&lt;br&gt;Steve Freeman
&lt;br&gt;Winner of the Agile Alliance Gordon Pask award 2006
&lt;br&gt;&lt;br&gt;&lt;a href=&quot;http://www.m3p.co.uk&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.m3p.co.uk&lt;/a&gt;&lt;br&gt;&lt;br&gt;M3P Limited.
&lt;br&gt;Registered office. 2 Church Street, Burnham, Bucks, SL1 7HZ.
&lt;br&gt;Company registered in England &amp; Wales. Number 03689627
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;---------------------------------------------------------------------
&lt;br&gt;To unsubscribe from this list, please visit:
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://xircles.codehaus.org/manage_email&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://xircles.codehaus.org/manage_email&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/jMock---User-f2665.html&quot; embed=&quot;fixTarget[2665]&quot; target=&quot;_top&quot; &gt;jMock - User&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/%22java.lang.IllegalArgumentException%3A-a-mock-with-name-...-already-exists%22-with-jmock2.5.0-tp19564926p19566921.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19566877</id>
	<title>Re: &quot;java.lang.IllegalArgumentException: a mock with name ... already exists&quot; with jmock2.5.0</title>
	<published>2008-09-18T23:19:58Z</published>
	<updated>2008-09-18T23:19:58Z</updated>
	<author>
		<name>Nat Pryce</name>
	</author>
	<content type="html">Give your mock Collectors explicit names that are different and
&lt;br&gt;explain what is different between them.
&lt;br&gt;&lt;br&gt;--Nat
&lt;br&gt;&lt;br&gt;2008/9/19 王軍＠Neusoft &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19566877&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;wangjun@...&lt;/a&gt;&amp;gt;:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Hi
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I got a problem with jmock2.5.0.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Below is my tests that past under jmock2.2.0. After upgrading jmock to
&lt;br&gt;&amp;gt; 2.5.0, these tests got failed with the stack trace below.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; @Test
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; public void testCollectMissDataRight() throws Exception {
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; final Collector &amp;nbsp;collector0 = context.mock(Collector.class);
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; final SocketSession fSession = context.mock(SocketSession.class);
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MaintenanceSession session =
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; new MaintenanceSession(null,collector0);
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; context.checking(new Expectations() {
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; one(collector0).isConnectedSector(with(equal(&amp;quot;TACC00&amp;quot;)));
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; will(returnValue(fSession));
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; one(fSession).startCollectLeftData((byte[])with(anything()));
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; });
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; byte[] data = &amp;quot;0000004820000001234567890123456789012345678999
&lt;br&gt;&amp;gt; TACC00 &amp;nbsp;&amp;quot;.getBytes();
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; session.processData(data);
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; context.assertIsSatisfied();
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; @Test
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; public void testCollectMissDataWrong() throws Exception {
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; final Collector &amp;nbsp;collector1 = context.mock(Collector.class);
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; final SocketSession fSession1 = context.mock(SocketSession.class);
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MaintenanceSession session =
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; new MaintenanceSession(null,collector1);
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; context.checking(new Expectations() {
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; one(collector1).isConnectedSector(with(equal(&amp;quot;TACC00&amp;quot;)));
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; will(returnValue(null));
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; never(fSession1).startCollectLeftData((byte[])with(anything()));
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; one(collector1).processAPError((String)with(anything()));
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; });
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; byte[] data = &amp;quot;0000004820000001234567890123456789012345678999
&lt;br&gt;&amp;gt; TACC00 &amp;nbsp;&amp;quot;.getBytes();
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; session.processData(data);
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; context.assertIsSatisfied();
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; java.lang.IllegalArgumentException: a mock with name collector already
&lt;br&gt;&amp;gt; exists
&lt;br&gt;&amp;gt; &amp;nbsp;at org.jmock.Mockery.mock(Mockery.java:128)
&lt;br&gt;&amp;gt; &amp;nbsp;at org.jmock.Mockery.mock(Mockery.java:120)
&lt;br&gt;&amp;gt; &amp;nbsp;at
&lt;br&gt;&amp;gt; rae07a.collect.MaintenanceSessionTest.testCollectMissDataWrong(MaintenanceSessionTest.java:45)
&lt;br&gt;&amp;gt; &amp;nbsp;at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
&lt;br&gt;&amp;gt; &amp;nbsp;at
&lt;br&gt;&amp;gt; sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
&lt;br&gt;&amp;gt; &amp;nbsp;at
&lt;br&gt;&amp;gt; sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
&lt;br&gt;&amp;gt; &amp;nbsp;at java.lang.reflect.Method.invoke(Method.java:585)
&lt;br&gt;&amp;gt; &amp;nbsp;at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:59)
&lt;br&gt;&amp;gt; &amp;nbsp;at
&lt;br&gt;&amp;gt; org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:98)
&lt;br&gt;&amp;gt; &amp;nbsp;at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79)
&lt;br&gt;&amp;gt; &amp;nbsp;at
&lt;br&gt;&amp;gt; org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:87)
&lt;br&gt;&amp;gt; &amp;nbsp;at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77)
&lt;br&gt;&amp;gt; &amp;nbsp;at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42)
&lt;br&gt;&amp;gt; &amp;nbsp;at
&lt;br&gt;&amp;gt; org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:88)
&lt;br&gt;&amp;gt; &amp;nbsp;at
&lt;br&gt;&amp;gt; org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
&lt;br&gt;&amp;gt; &amp;nbsp;at
&lt;br&gt;&amp;gt; org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
&lt;br&gt;&amp;gt; &amp;nbsp;at
&lt;br&gt;&amp;gt; org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
&lt;br&gt;&amp;gt; &amp;nbsp;at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
&lt;br&gt;&amp;gt; &amp;nbsp;at
&lt;br&gt;&amp;gt; org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
&lt;br&gt;&amp;gt; &amp;nbsp;at
&lt;br&gt;&amp;gt; org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
&lt;br&gt;&amp;gt; &amp;nbsp;at
&lt;br&gt;&amp;gt; org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
&lt;br&gt;&amp;gt; &amp;nbsp;at
&lt;br&gt;&amp;gt; org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
&lt;br&gt;&amp;gt; &amp;nbsp;at
&lt;br&gt;&amp;gt; org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
&lt;br&gt;&amp;gt; &amp;nbsp;at
&lt;br&gt;&amp;gt; org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
&lt;br&gt;&amp;gt; &amp;nbsp;at
&lt;br&gt;&amp;gt; org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I got into jmock2.50 source and found out this problem has something to do
&lt;br&gt;&amp;gt; with defaultNameFor method which always gives the same name for the same
&lt;br&gt;&amp;gt; class.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; public &amp;lt;T&amp;gt; T mock(Class&amp;lt;T&amp;gt; typeToMock) {
&lt;br&gt;&amp;gt; &amp;nbsp; return mock(typeToMock, namingScheme.defaultNameFor(typeToMock));
&lt;br&gt;&amp;gt; &amp;nbsp;}
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Maybe this is supposed to do. Can anybody help me with some answer?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; James
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; ________________________________
&lt;br&gt;&amp;gt; Confidentiality Notice: The information contained in this e-mail and any
&lt;br&gt;&amp;gt; accompanying attachment(s) is intended only for the use of the intended
&lt;br&gt;&amp;gt; recipient and may be confidential and/or privileged of Neusoft Corporation,
&lt;br&gt;&amp;gt; its subsidiaries and/or its affiliates. If any reader of this communication
&lt;br&gt;&amp;gt; is not the intended recipient, unauthorized use, forwarding, printing,
&lt;br&gt;&amp;gt; storing, disclosure or copying is strictly prohibited, and may be unlawful.
&lt;br&gt;&amp;gt; If you have received this communication in error, please immediately notify
&lt;br&gt;&amp;gt; the sender by return e-mail, and delete the original message and all copies
&lt;br&gt;&amp;gt; from your system. Thank you.
&lt;br&gt;&amp;gt; ________________________________
&lt;/div&gt;&lt;br&gt;---------------------------------------------------------------------
&lt;br&gt;To unsubscribe from this list, please visit:
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://xircles.codehaus.org/manage_email&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://xircles.codehaus.org/manage_email&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/jMock---User-f2665.html&quot; embed=&quot;fixTarget[2665]&quot; target=&quot;_top&quot; &gt;jMock - User&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/%22java.lang.IllegalArgumentException%3A-a-mock-with-name-...-already-exists%22-with-jmock2.5.0-tp19564926p19566877.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19564926</id>
	<title>&quot;java.lang.IllegalArgumentException: a mock with name ... already exists&quot; with jmock2.5.0</title>
	<published>2008-09-18T18:40:34Z</published>
	<updated>2008-09-18T18:40:34Z</updated>
	<author>
		<name>jamesnot007</name>
	</author>
	<content type="html">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0 Transitional//EN&quot;&gt;
&lt;HTML&gt;&lt;HEAD&gt;
&lt;META http-equiv=Content-Type content=&quot;text/html; charset=iso-2022-jp&quot;&gt;
&lt;META content=&quot;MSHTML 6.00.2900.3395&quot; name=GENERATOR&gt;

&lt;/HEAD&gt;
&lt;BODY bgColor=#ffffff&gt;
&lt;DIV&gt;&lt;FONT size=2&gt;Hi&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT size=2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT size=2&gt;I got a problem with jmock2.5.0.&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT size=2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT size=2&gt;Below is my tests that past under jmock2.2.0. After upgrading 
jmock to 2.5.0, these tests got failed with the stack trace below.&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT size=2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; @Test&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void 
testCollectMissDataRight() throws Exception 
{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; final Collector&amp;nbsp; collector0 
= context.mock(Collector.class);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
final SocketSession fSession = 
context.mock(SocketSession.class);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MaintenanceSession session 
=&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; new 
MaintenanceSession(null,collector0);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; context.checking(new 
Expectations() 
{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
one(collector0).isConnectedSector(with(equal(&quot;TACC00&quot;)));&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
will(returnValue(fSession));&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
one(fSession).startCollectLeftData((byte[])with(anything()));&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
}&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
});&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; byte[] data = 
&quot;0000004820000001234567890123456789012345678999&amp;nbsp; TACC00&amp;nbsp; 
&quot;.getBytes();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
session.processData(data);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
context.assertIsSatisfied();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; @Test&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void 
testCollectMissDataWrong() throws Exception 
{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; final Collector&amp;nbsp; collector1 
= context.mock(Collector.class);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
final SocketSession fSession1 = 
context.mock(SocketSession.class);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MaintenanceSession session 
=&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; new 
MaintenanceSession(null,collector1);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; context.checking(new 
Expectations() 
{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
one(collector1).isConnectedSector(with(equal(&quot;TACC00&quot;)));&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
will(returnValue(null));&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
never(fSession1).startCollectLeftData((byte[])with(anything()));&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
one(collector1).processAPError((String)with(anything()));&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
}&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
});&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; byte[] data = 
&quot;0000004820000001234567890123456789012345678999&amp;nbsp; TACC00&amp;nbsp; 
&quot;.getBytes();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
session.processData(data);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
context.assertIsSatisfied();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT size=2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT size=2&gt;java.lang.IllegalArgumentException: a mock with name collector 
already exists&lt;BR&gt;&amp;nbsp;at org.jmock.Mockery.mock(Mockery.java:128)&lt;BR&gt;&amp;nbsp;at 
org.jmock.Mockery.mock(Mockery.java:120)&lt;BR&gt;&amp;nbsp;at 
rae07a.collect.MaintenanceSessionTest.testCollectMissDataWrong(MaintenanceSessionTest.java:45)&lt;BR&gt;&amp;nbsp;at 
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)&lt;BR&gt;&amp;nbsp;at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)&lt;BR&gt;&amp;nbsp;at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)&lt;BR&gt;&amp;nbsp;at 
java.lang.reflect.Method.invoke(Method.java:585)&lt;BR&gt;&amp;nbsp;at 
org.junit.internal.runners.TestMethod.invoke(TestMethod.java:59)&lt;BR&gt;&amp;nbsp;at 
org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:98)&lt;BR&gt;&amp;nbsp;at 
org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79)&lt;BR&gt;&amp;nbsp;at 
org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:87)&lt;BR&gt;&amp;nbsp;at 
org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77)&lt;BR&gt;&amp;nbsp;at 
org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42)&lt;BR&gt;&amp;nbsp;at 
org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:88)&lt;BR&gt;&amp;nbsp;at 
org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)&lt;BR&gt;&amp;nbsp;at 
org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)&lt;BR&gt;&amp;nbsp;at 
org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)&lt;BR&gt;&amp;nbsp;at 
org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)&lt;BR&gt;&amp;nbsp;at 
org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)&lt;BR&gt;&amp;nbsp;at 
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)&lt;BR&gt;&amp;nbsp;at 
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)&lt;BR&gt;&amp;nbsp;at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)&lt;BR&gt;&amp;nbsp;at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)&lt;BR&gt;&amp;nbsp;at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)&lt;BR&gt;&amp;nbsp;at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT size=2&gt;I got into jmock2.50 source and found out this problem has 
something to do with defaultNameFor method which always gives the same name for 
the same class.&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT size=2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public &amp;lt;T&amp;gt; T mock(Class&amp;lt;T&amp;gt; 
typeToMock) {&lt;BR&gt;&amp;nbsp;&amp;nbsp;return mock(typeToMock, 
namingScheme.defaultNameFor(typeToMock));&lt;BR&gt;&amp;nbsp;}&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT size=2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT size=2&gt;Maybe this is supposed to do. Can anybody help me with some 
answer?&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT size=2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT size=2&gt;James&lt;/DIV&gt;
&lt;DIV&gt;&lt;BR&gt;&lt;/DIV&gt;&lt;/FONT&gt;&lt;/BODY&gt;&lt;br&gt;
&lt;FONT size=2&gt;
          &lt;HR color=#000099&gt;
          &lt;FONT color=#000099&gt;&lt;STRONG&gt;Confidentiality Notice:&lt;/STRONG&gt; The information 
          contained in this e-mail and any accompanying attachment(s) 
          is intended only for the use of the intended recipient and may be confidential 
          and/or privileged of Neusoft Corporation, its subsidiaries and/or its 
          affiliates. If any reader of this communication is not the intended 
          recipient, unauthorized use, forwarding, printing, storing, disclosure 
          or copying is strictly prohibited, and may be unlawful. If you have 
          received this communication in error, please immediately notify the 
          sender by return e-mail, and delete the original message and all copies 
          from your system. Thank you. &lt;/FONT&gt; 
          &lt;HR color=#000099&gt;
          &lt;/FONT&gt;
&lt;/HTML&gt;
&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/jMock---User-f2665.html&quot; embed=&quot;fixTarget[2665]&quot; target=&quot;_top&quot; &gt;jMock - User&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/%22java.lang.IllegalArgumentException%3A-a-mock-with-name-...-already-exists%22-with-jmock2.5.0-tp19564926p19564926.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19526848</id>
	<title>Re: how to test exception condition in Junit</title>
	<published>2008-09-17T00:10:44Z</published>
	<updated>2008-09-17T00:10:44Z</updated>
	<author>
		<name>Steve Freeman-2</name>
	</author>
	<content type="html">This message
&lt;br&gt;&lt;br&gt;org.jmock.core.DynamicMockError: mockHttpServletRequest: unexpected &amp;nbsp;
&lt;br&gt;invocation
&lt;br&gt;Invoked: mockHttpServletRequest.getParameter(&amp;quot;beginDate&amp;quot;)
&lt;br&gt;Allowed:
&lt;br&gt;expected once and has been invoked: getParameter( eq(&amp;quot;distId&amp;quot;) ), &amp;nbsp;
&lt;br&gt;returns null
&lt;br&gt;&lt;br&gt;is telling you that you called getParameter() but didn't set up either &amp;nbsp;
&lt;br&gt;a stub or expectation, so the mock doesn't know what to do.
&lt;br&gt;&lt;br&gt;&lt;br&gt;S.
&lt;br&gt;&lt;br&gt;---------------------------------------------------------------------
&lt;br&gt;To unsubscribe from this list, please visit:
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://xircles.codehaus.org/manage_email&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://xircles.codehaus.org/manage_email&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/jMock---User-f2665.html&quot; embed=&quot;fixTarget[2665]&quot; target=&quot;_top&quot; &gt;jMock - User&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/how-to-test-exception-condition-in-Junit-tp19521331p19526848.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19521331</id>
	<title>how to test exception condition in Junit</title>
	<published>2008-09-16T14:44:53Z</published>
	<updated>2008-09-16T14:44:53Z</updated>
	<author>
		<name>Sushil Dodake</name>
	</author>
	<content type="html">&lt;div dir=&quot;ltr&quot;&gt;&lt;div&gt;i am trying to write a test case for the exception scenario.&lt;/div&gt;
&lt;div&gt;my code looks as below.&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;font size=&quot;2&quot;&gt;
&lt;p align=&quot;left&quot;&gt;&lt;/p&gt;&lt;/font&gt;&lt;b&gt;&lt;font color=&quot;#7f0055&quot; size=&quot;2&quot;&gt;public&lt;/font&gt;&lt;/b&gt;&lt;font size=&quot;2&quot;&gt; ActionForward execute(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) &lt;/font&gt;&lt;b&gt;&lt;font color=&quot;#7f0055&quot; size=&quot;2&quot;&gt;throws&lt;/font&gt;&lt;/b&gt;&lt;font size=&quot;2&quot;&gt; Exception {
&lt;p align=&quot;left&quot;&gt;ActionForward actionforward = &lt;/p&gt;&lt;/font&gt;&lt;b&gt;&lt;font color=&quot;#7f0055&quot; size=&quot;2&quot;&gt;null&lt;/font&gt;&lt;/b&gt;&lt;font size=&quot;2&quot;&gt;; 
&lt;p align=&quot;left&quot;&gt;&lt;/p&gt;&lt;/font&gt;&lt;b&gt;&lt;font color=&quot;#7f0055&quot; size=&quot;2&quot;&gt;try&lt;/font&gt;&lt;/b&gt;&lt;font size=&quot;2&quot;&gt;{
&lt;p align=&quot;left&quot;&gt;SimpleDateFormat format = &lt;/p&gt;&lt;/font&gt;&lt;b&gt;&lt;font color=&quot;#7f0055&quot; size=&quot;2&quot;&gt;new&lt;/font&gt;&lt;/b&gt;&lt;font size=&quot;2&quot;&gt; SimpleDateFormat(ReportingConstant.&lt;/font&gt;&lt;i&gt;&lt;font color=&quot;#0000c0&quot; size=&quot;2&quot;&gt;DATE_FORMAT&lt;/font&gt;&lt;/i&gt;&lt;font size=&quot;2&quot;&gt;);
&lt;p align=&quot;left&quot;&gt;ReportRequest reportReq = &lt;/p&gt;&lt;/font&gt;&lt;b&gt;&lt;font color=&quot;#7f0055&quot; size=&quot;2&quot;&gt;new&lt;/font&gt;&lt;/b&gt;&lt;font size=&quot;2&quot;&gt; ReportRequest();
&lt;p align=&quot;left&quot;&gt;&lt;/p&gt;
&lt;p align=&quot;left&quot;&gt;String distID = request.getParameter(&lt;/p&gt;&lt;/font&gt;&lt;font color=&quot;#2a00ff&quot; size=&quot;2&quot;&gt;&amp;quot;distId&amp;quot;&lt;/font&gt;&lt;font size=&quot;2&quot;&gt;);
&lt;p align=&quot;left&quot;&gt;String beginDate = request.getParameter(&lt;/p&gt;&lt;/font&gt;&lt;font color=&quot;#2a00ff&quot; size=&quot;2&quot;&gt;&amp;quot;beginDate&amp;quot;&lt;/font&gt;&lt;font size=&quot;2&quot;&gt;);
&lt;p align=&quot;left&quot;&gt;String endDate = request.getParameter(&lt;/p&gt;&lt;/font&gt;&lt;font color=&quot;#2a00ff&quot; size=&quot;2&quot;&gt;&amp;quot;endDate&amp;quot;&lt;/font&gt;&lt;font size=&quot;2&quot;&gt;);
&lt;p align=&quot;left&quot;&gt;&lt;/p&gt;
&lt;p align=&quot;left&quot;&gt;&lt;/p&gt;&lt;/font&gt;&lt;b&gt;&lt;font color=&quot;#7f0055&quot; size=&quot;2&quot;&gt;if&lt;/font&gt;&lt;/b&gt;&lt;font size=&quot;2&quot;&gt;(&lt;/font&gt;&lt;b&gt;&lt;font color=&quot;#7f0055&quot; size=&quot;2&quot;&gt;null&lt;/font&gt;&lt;/b&gt;&lt;font size=&quot;2&quot;&gt; != beginDate){
&lt;p align=&quot;left&quot;&gt;reportReq.setBeginDate(format.parse(beginDate));&lt;/p&gt;
&lt;p align=&quot;left&quot;&gt;}&lt;/p&gt;&lt;/font&gt;&lt;b&gt;&lt;font color=&quot;#7f0055&quot; size=&quot;2&quot;&gt;else&lt;/font&gt;&lt;/b&gt;&lt;font size=&quot;2&quot;&gt;{
&lt;p align=&quot;left&quot;&gt;&lt;/p&gt;&lt;/font&gt;&lt;i&gt;&lt;font color=&quot;#0000c0&quot; size=&quot;2&quot;&gt;LOG&lt;/font&gt;&lt;/i&gt;&lt;font size=&quot;2&quot;&gt;.error(&lt;/font&gt;&lt;font color=&quot;#2a00ff&quot; size=&quot;2&quot;&gt;&amp;quot;Begin date not present in the received form &amp;quot;&lt;/font&gt;&lt;font size=&quot;2&quot;&gt;);
&lt;p align=&quot;left&quot;&gt;&lt;/p&gt;&lt;/font&gt;&lt;b&gt;&lt;font color=&quot;#7f0055&quot; size=&quot;2&quot;&gt;throw&lt;/font&gt;&lt;/b&gt;&lt;font size=&quot;2&quot;&gt; &lt;/font&gt;&lt;b&gt;&lt;font color=&quot;#7f0055&quot; size=&quot;2&quot;&gt;new&lt;/font&gt;&lt;/b&gt;&lt;font size=&quot;2&quot;&gt; ReportingException(&lt;/font&gt;&lt;font color=&quot;#2a00ff&quot; size=&quot;2&quot;&gt;&amp;quot;Begin date not present in the received form&amp;quot;&lt;/font&gt;&lt;font size=&quot;2&quot;&gt;);
&lt;p align=&quot;left&quot;&gt;}&lt;/p&gt;
&lt;p align=&quot;left&quot;&gt;&lt;/p&gt;
&lt;p align=&quot;left&quot;&gt;&lt;/p&gt;&lt;/font&gt;&lt;b&gt;&lt;font color=&quot;#7f0055&quot; size=&quot;2&quot;&gt;if&lt;/font&gt;&lt;/b&gt;&lt;font size=&quot;2&quot;&gt;(&lt;/font&gt;&lt;b&gt;&lt;font color=&quot;#7f0055&quot; size=&quot;2&quot;&gt;null&lt;/font&gt;&lt;/b&gt;&lt;font size=&quot;2&quot;&gt; != endDate){
&lt;p align=&quot;left&quot;&gt;reportReq.setEndDate(format.parse(endDate));&lt;/p&gt;
&lt;p align=&quot;left&quot;&gt;}&lt;/p&gt;&lt;/font&gt;&lt;b&gt;&lt;font color=&quot;#7f0055&quot; size=&quot;2&quot;&gt;else&lt;/font&gt;&lt;/b&gt;&lt;font size=&quot;2&quot;&gt;{
&lt;p align=&quot;left&quot;&gt;&lt;/p&gt;&lt;/font&gt;&lt;i&gt;&lt;font color=&quot;#0000c0&quot; size=&quot;2&quot;&gt;LOG&lt;/font&gt;&lt;/i&gt;&lt;font size=&quot;2&quot;&gt;.error(&lt;/font&gt;&lt;font color=&quot;#2a00ff&quot; size=&quot;2&quot;&gt;&amp;quot;End date not present in the received form &amp;quot;&lt;/font&gt;&lt;font size=&quot;2&quot;&gt;);
&lt;p align=&quot;left&quot;&gt;&lt;/p&gt;&lt;/font&gt;&lt;b&gt;&lt;font color=&quot;#7f0055&quot; size=&quot;2&quot;&gt;throw&lt;/font&gt;&lt;/b&gt;&lt;font size=&quot;2&quot;&gt; &lt;/font&gt;&lt;b&gt;&lt;font color=&quot;#7f0055&quot; size=&quot;2&quot;&gt;new&lt;/font&gt;&lt;/b&gt;&lt;font size=&quot;2&quot;&gt; ReportingException(&lt;/font&gt;&lt;font color=&quot;#2a00ff&quot; size=&quot;2&quot;&gt;&amp;quot;End date not present in the received form&amp;quot;&lt;/font&gt;&lt;font size=&quot;2&quot;&gt;);
&lt;p align=&quot;left&quot;&gt;}&lt;/p&gt;
&lt;p align=&quot;left&quot;&gt;&lt;/p&gt;
&lt;p align=&quot;left&quot;&gt;&lt;/p&gt;&lt;/font&gt;&lt;b&gt;&lt;font color=&quot;#7f0055&quot; size=&quot;2&quot;&gt;if&lt;/font&gt;&lt;/b&gt;&lt;font size=&quot;2&quot;&gt;(&lt;/font&gt;&lt;b&gt;&lt;font color=&quot;#7f0055&quot; size=&quot;2&quot;&gt;null&lt;/font&gt;&lt;/b&gt;&lt;font size=&quot;2&quot;&gt; != distID){
&lt;p align=&quot;left&quot;&gt;reportReq.setDistributorId(distID);&lt;/p&gt;
&lt;p align=&quot;left&quot;&gt;}&lt;/p&gt;&lt;/font&gt;&lt;b&gt;&lt;font color=&quot;#7f0055&quot; size=&quot;2&quot;&gt;else&lt;/font&gt;&lt;/b&gt;&lt;font size=&quot;2&quot;&gt;{
&lt;p align=&quot;left&quot;&gt;&lt;/p&gt;&lt;/font&gt;&lt;i&gt;&lt;font color=&quot;#0000c0&quot; size=&quot;2&quot;&gt;LOG&lt;/font&gt;&lt;/i&gt;&lt;font size=&quot;2&quot;&gt;.error(&lt;/font&gt;&lt;font color=&quot;#2a00ff&quot; size=&quot;2&quot;&gt;&amp;quot;Distributor Id not present in the received form &amp;quot;&lt;/font&gt;&lt;font size=&quot;2&quot;&gt;);
&lt;p align=&quot;left&quot;&gt;&lt;/p&gt;&lt;/font&gt;&lt;b&gt;&lt;font color=&quot;#7f0055&quot; size=&quot;2&quot;&gt;throw&lt;/font&gt;&lt;/b&gt;&lt;font size=&quot;2&quot;&gt; &lt;/font&gt;&lt;b&gt;&lt;font color=&quot;#7f0055&quot; size=&quot;2&quot;&gt;new&lt;/font&gt;&lt;/b&gt;&lt;font size=&quot;2&quot;&gt; ReportingException(&lt;/font&gt;&lt;font color=&quot;#2a00ff&quot; size=&quot;2&quot;&gt;&amp;quot;Distributor Id not present in the received form &amp;quot;&lt;/font&gt;&lt;font size=&quot;2&quot;&gt;);
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;some code....&lt;/p&gt;&lt;font size=&quot;2&quot;&gt;
&lt;p align=&quot;left&quot;&gt;}&lt;/p&gt;&lt;/font&gt;&lt;b&gt;&lt;font color=&quot;#7f0055&quot; size=&quot;2&quot;&gt;catch&lt;/font&gt;&lt;/b&gt;&lt;/font&gt;&lt;font size=&quot;2&quot;&gt;(Exception e){
&lt;p align=&quot;left&quot;&gt;&lt;/p&gt;&lt;/font&gt;&lt;i&gt;&lt;font color=&quot;#0000c0&quot; size=&quot;2&quot;&gt;LOG&lt;/font&gt;&lt;/i&gt;&lt;font size=&quot;2&quot;&gt;.error(&lt;/font&gt;&lt;font color=&quot;#2a00ff&quot; size=&quot;2&quot;&gt;&amp;quot;Error sending XLS file to the client &amp;quot;&lt;/font&gt;&lt;font size=&quot;2&quot;&gt;,e);
&lt;p align=&quot;left&quot;&gt;actionforward = mapping.findForward(&lt;/p&gt;&lt;/font&gt;&lt;font color=&quot;#2a00ff&quot; size=&quot;2&quot;&gt;&amp;quot;exception&amp;quot;&lt;/font&gt;&lt;font size=&quot;2&quot;&gt;);
&lt;p align=&quot;left&quot;&gt;}&lt;/p&gt;
&lt;p align=&quot;left&quot;&gt;&lt;/p&gt;&lt;/font&gt;&lt;b&gt;&lt;font color=&quot;#7f0055&quot; size=&quot;2&quot;&gt;return&lt;/font&gt;&lt;/b&gt;&lt;font size=&quot;2&quot;&gt; actionforward; 
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;now i would like to test a execute method for exception i.e. i am expecting that if the request obj do not have any parameters set then my code will throw an exception.&lt;/p&gt;
&lt;p&gt;and i need to verify that.&lt;/p&gt;
&lt;p&gt;my test case method is like..&lt;/p&gt;&lt;font size=&quot;2&quot;&gt;
&lt;p align=&quot;left&quot;&gt;&lt;/p&gt;&lt;/font&gt;&lt;b&gt;&lt;font color=&quot;#7f0055&quot; size=&quot;2&quot;&gt;public&lt;/font&gt;&lt;/b&gt;&lt;/font&gt;&lt;font size=&quot;2&quot;&gt; &lt;/font&gt;&lt;b&gt;&lt;font color=&quot;#7f0055&quot; size=&quot;2&quot;&gt;void&lt;/font&gt;&lt;/b&gt;&lt;font size=&quot;2&quot;&gt; testDownloadXLSReportFailure()&lt;/font&gt;&lt;b&gt;&lt;font color=&quot;#7f0055&quot; size=&quot;2&quot;&gt;throws&lt;/font&gt;&lt;/b&gt;&lt;font size=&quot;2&quot;&gt; Exception{
&lt;p align=&quot;left&quot;&gt;&lt;/p&gt;&lt;/font&gt;&lt;font color=&quot;#0000c0&quot; size=&quot;2&quot;&gt;httpServletRequestMock&lt;/font&gt;&lt;font size=&quot;2&quot;&gt;.expects(once())
&lt;p align=&quot;left&quot;&gt;.method(&lt;/p&gt;&lt;/font&gt;&lt;font color=&quot;#2a00ff&quot; size=&quot;2&quot;&gt;&amp;quot;getParameter&amp;quot;&lt;/font&gt;&lt;font size=&quot;2&quot;&gt;)
&lt;p align=&quot;left&quot;&gt;.with(eq(&lt;/p&gt;&lt;/font&gt;&lt;font color=&quot;#2a00ff&quot; size=&quot;2&quot;&gt;&amp;quot;distId&amp;quot;&lt;/font&gt;&lt;font size=&quot;2&quot;&gt;))
&lt;p align=&quot;left&quot;&gt;.will(returnValue(&lt;/p&gt;&lt;/font&gt;&lt;b&gt;&lt;font color=&quot;#7f0055&quot; size=&quot;2&quot;&gt;null&lt;/font&gt;&lt;/b&gt;&lt;font size=&quot;2&quot;&gt;));&lt;/font&gt;&lt;font size=&quot;2&quot;&gt;&lt;font color=&quot;#0000c0&quot; size=&quot;2&quot;&gt;
&lt;p&gt;request&lt;/p&gt;&lt;/font&gt;&lt;font size=&quot;2&quot;&gt; = (HttpServletRequest)&lt;/font&gt;&lt;font color=&quot;#0000c0&quot; size=&quot;2&quot;&gt;httpServletRequestMock&lt;/font&gt;&lt;font size=&quot;2&quot;&gt;.proxy();&lt;/font&gt;
&lt;p align=&quot;left&quot;&gt;&lt;/p&gt;
&lt;p align=&quot;left&quot;&gt;&lt;/p&gt;&lt;/font&gt;&lt;b&gt;&lt;font color=&quot;#7f0055&quot; size=&quot;2&quot;&gt;try&lt;/font&gt;&lt;/b&gt;&lt;font size=&quot;2&quot;&gt;{
&lt;p align=&quot;left&quot;&gt;ActionForward forward = &lt;/p&gt;&lt;/font&gt;&lt;font color=&quot;#0000c0&quot; size=&quot;2&quot;&gt;downloadReportAction&lt;/font&gt;&lt;font size=&quot;2&quot;&gt;.execute(&lt;/font&gt;&lt;font color=&quot;#0000c0&quot; size=&quot;2&quot;&gt;actionMapping&lt;/font&gt;&lt;font size=&quot;2&quot;&gt;, &lt;/font&gt;&lt;font color=&quot;#0000c0&quot; size=&quot;2&quot;&gt;reportForm&lt;/font&gt;&lt;font size=&quot;2&quot;&gt;, &lt;/font&gt;&lt;font color=&quot;#0000c0&quot; size=&quot;2&quot;&gt;request&lt;/font&gt;&lt;font size=&quot;2&quot;&gt;, &lt;/font&gt;&lt;font color=&quot;#0000c0&quot; size=&quot;2&quot;&gt;response&lt;/font&gt;&lt;font size=&quot;2&quot;&gt;);
&lt;p align=&quot;left&quot;&gt;&lt;i&gt;fail&lt;/i&gt;(&lt;/p&gt;&lt;/font&gt;&lt;font color=&quot;#2a00ff&quot; size=&quot;2&quot;&gt;&amp;quot;Error ..&amp;quot;&lt;/font&gt;&lt;font size=&quot;2&quot;&gt;);
&lt;p align=&quot;left&quot;&gt;}&lt;/p&gt;&lt;/font&gt;&lt;b&gt;&lt;font color=&quot;#7f0055&quot; size=&quot;2&quot;&gt;catch&lt;/font&gt;&lt;/b&gt;&lt;font size=&quot;2&quot;&gt;(Exception e){
&lt;p align=&quot;left&quot;&gt;&lt;/p&gt;
&lt;p align=&quot;left&quot;&gt;} &lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;&lt;/font&gt;
&lt;p&gt;org.jmock.core.DynamicMockError: mockHttpServletRequest: unexpected invocation&lt;br&gt;Invoked: mockHttpServletRequest.getParameter(&amp;quot;beginDate&amp;quot;)&lt;br&gt;Allowed:&lt;br&gt;expected once and has been invoked: getParameter( eq(&amp;quot;distId&amp;quot;) ), returns null&lt;/p&gt;

&lt;p&gt;&amp;nbsp;at org.jmock.core.AbstractDynamicMock.mockInvocation(AbstractDynamicMock.java:58)&lt;br&gt;&amp;nbsp;at org.jmock.cglib.CGLIBCoreMock.intercept(CGLIBCoreMock.java:71)&lt;br&gt;&amp;nbsp;at $javax.servlet.http.HttpServletRequest$$EnhancerByCGLIB$$7c120c24.getParameter(&amp;lt;generated&amp;gt;)&lt;br&gt;
&amp;nbsp;at com.toro.rebate.reporting.struts.action.DownloadXLSCommercialReportAction.execute(DownloadXLSCommercialReportAction.java:47)&lt;br&gt;&amp;nbsp;at com.toro.rebate.reporting.struts.action.DownloadXLSCommercialReportActionTest.testDownloadXLSReportFailure(DownloadXLSCommercialReportActionTest.java:116)&lt;br&gt;
&amp;nbsp;at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)&lt;br&gt;&amp;nbsp;at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)&lt;br&gt;&amp;nbsp;at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)&lt;br&gt;
&amp;nbsp;at java.lang.reflect.Method.invoke(Method.java:597)&lt;br&gt;&amp;nbsp;at junit.framework.TestCase.runTest(TestCase.java:154)&lt;br&gt;&amp;nbsp;at org.jmock.core.VerifyingTestCase.runBare(VerifyingTestCase.java:39)&lt;br&gt;&amp;nbsp;at junit.framework.TestResult$1.protect(TestResult.java:106)&lt;br&gt;
&amp;nbsp;at junit.framework.TestResult.runProtected(TestResult.java:124)&lt;br&gt;&amp;nbsp;at junit.framework.TestResult.run(TestResult.java:109)&lt;br&gt;&amp;nbsp;at junit.framework.TestCase.run(TestCase.java:118)&lt;br&gt;&amp;nbsp;at junit.framework.TestSuite.runTest(TestSuite.java:208)&lt;br&gt;
&amp;nbsp;at junit.framework.TestSuite.run(TestSuite.java:203)&lt;br&gt;&amp;nbsp;at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)&lt;br&gt;&amp;nbsp;at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)&lt;br&gt;
&amp;nbsp;at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)&lt;br&gt;&amp;nbsp;at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)&lt;br&gt;&amp;nbsp;at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)&lt;br&gt;
&amp;nbsp;at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)&lt;/p&gt;
&lt;p&gt;can sombody tell me how do i chk the exception condition here?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;thanks,&lt;/p&gt;
&lt;p&gt;sush&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/jMock---User-f2665.html&quot; embed=&quot;fixTarget[2665]&quot; target=&quot;_top&quot; &gt;jMock - User&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/how-to-test-exception-condition-in-Junit-tp19521331p19521331.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19520535</id>
	<title>[jira] Closed: (JMOCK-204) Documentation does not use the oneOf method</title>
	<published>2008-09-16T13:59:48Z</published>
	<updated>2008-09-16T13:59:48Z</updated>
	<author>
		<name>JIRA jira@codehaus.org</name>
	</author>
	<content type="html">&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;[ &lt;a href=&quot;http://jira.codehaus.org/browse/JMOCK-204?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://jira.codehaus.org/browse/JMOCK-204?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel&lt;/a&gt;&amp;nbsp;]
&lt;br&gt;&lt;br&gt;Nat Pryce closed JMOCK-204.
&lt;br&gt;---------------------------
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; Resolution: Fixed
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Documentation does not use the oneOf method
&lt;br&gt;&amp;gt; -------------------------------------------
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Key: JMOCK-204
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; URL: &lt;a href=&quot;http://jira.codehaus.org/browse/JMOCK-204&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://jira.codehaus.org/browse/JMOCK-204&lt;/a&gt;&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Project: jMock
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Issue Type: Bug
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Components: Documentation
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;Affects Versions: Chore (ASAP)
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Reporter: Justin Wesley
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Priority: Minor
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Fix For: Chore (ASAP)
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; The documentation should also be changed to reflect that &amp;quot;oneOf&amp;quot; is preferred to &amp;quot;one&amp;quot;. I noticed 'one' is referenced in the sections 'Getting Started', 'Cookbook', and 'Cheat Sheet'.
&lt;/div&gt;&lt;br&gt;-- 
&lt;br&gt;This message is automatically generated by JIRA.
&lt;br&gt;-
&lt;br&gt;If you think it was sent incorrectly contact one of the administrators: &lt;a href=&quot;http://jira.codehaus.org/secure/Administrators.jspa&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://jira.codehaus.org/secure/Administrators.jspa&lt;/a&gt;&lt;br&gt;-
&lt;br&gt;For more information on JIRA, see: &lt;a href=&quot;http://www.atlassian.com/software/jira&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.atlassian.com/software/jira&lt;/a&gt;&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&lt;br&gt;&lt;br&gt;---------------------------------------------------------------------
&lt;br&gt;To unsubscribe from this list, please visit:
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://xircles.codehaus.org/manage_email&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://xircles.codehaus.org/manage_email&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/jMock---Dev-f2664.html&quot; embed=&quot;fixTarget[2664]&quot; target=&quot;_top&quot; &gt;jMock - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/-jira--Created%3A-%28JMOCK-204%29-Documentation-does-not-use-the-oneOf-method-tp19500523p19520535.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19508360</id>
	<title>Re: writing test case for struts action?</title>
	<published>2008-09-16T01:39:09Z</published>
	<updated>2008-09-16T01:39:09Z</updated>
	<author>
		<name>Steve Freeman-2</name>
	</author>
	<content type="html">1. Buy some of the TDD books. There are quite a few good ones out there.
&lt;br&gt;&lt;br&gt;2. In your case, create a concrete subclass of the ServletOutputStream &amp;nbsp;
&lt;br&gt;that writes to a StringBuffer and compare the result at the end of the &amp;nbsp;
&lt;br&gt;test. Once you're used to that, we can consider what to do next.
&lt;br&gt;&lt;br&gt;S.
&lt;br&gt;&lt;br&gt;On 16 Sep 2008, at 05:21, Sushil Dodake wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Hi All,
&lt;br&gt;&amp;gt; i am trying to write a test case for a struts action call.
&lt;br&gt;&amp;gt; in the action call i am trying to send a file on the response output &amp;nbsp;
&lt;br&gt;&amp;gt; stream.
&lt;br&gt;&amp;gt; when i get the output stream using response.getOutputstream i get a &amp;nbsp;
&lt;br&gt;&amp;gt; object
&lt;br&gt;&amp;gt; of ServletOurtputStream.
&lt;br&gt;&amp;gt; which is a abstract class..
&lt;br&gt;&amp;gt; i then write a byte stream on the output stream and fluch it to close
&lt;br&gt;&amp;gt; i am confused as to how to write a test case.
&lt;br&gt;&amp;gt; can sombody help me here?
&lt;br&gt;&amp;gt; any example?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; regards,
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Sush
&lt;/div&gt;&lt;br&gt;Steve Freeman
&lt;br&gt;Winner of the Agile Alliance Gordon Pask award 2006
&lt;br&gt;&lt;br&gt;&lt;a href=&quot;http://www.m3p.co.uk&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.m3p.co.uk&lt;/a&gt;&lt;br&gt;&lt;br&gt;M3P Limited.
&lt;br&gt;Registered office. 2 Church Street, Burnham, Bucks, SL1 7HZ.
&lt;br&gt;Company registered in England &amp; Wales. Number 03689627
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;---------------------------------------------------------------------
&lt;br&gt;To unsubscribe from this list, please visit:
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://xircles.codehaus.org/manage_email&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://xircles.codehaus.org/manage_email&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/jMock---User-f2665.html&quot; embed=&quot;fixTarget[2665]&quot; target=&quot;_top&quot; &gt;jMock - User&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/writing-test-case-for-struts-action--tp19505143p19508360.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19508326</id>
	<title>Re: writing test case for struts action?</title>
	<published>2008-09-16T01:09:36Z</published>
	<updated>2008-09-16T01:09:36Z</updated>
	<author>
		<name>Stephen Smith-2</name>
	</author>
	<content type="html">Have you considered mocking the HttpServletResponse and asserting that an output
&lt;br&gt;stream is retrieved from it?
&lt;br&gt;&lt;br&gt;On Tue 16/09/08 06:21 , &amp;quot;Sushil Dodake&amp;quot; &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19508326&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;sushil.dodake@...&lt;/a&gt; sent:
&lt;br&gt;&amp;gt; Hi All, i am trying to write a test case for a struts action call. in
&lt;br&gt;&amp;gt; the action call i am trying to send a file on the response output
&lt;br&gt;&amp;gt; stream. when i get the output stream using response.getOutputstream i
&lt;br&gt;&amp;gt; get a object of ServletOurtputStream. which is a abstract class.. &amp;nbsp;i
&lt;br&gt;&amp;gt; then write a byte stream on the output stream and fluch it to close 
&lt;br&gt;&amp;gt; i am confused as to how to write a test case. can sombody help me
&lt;br&gt;&amp;gt; here? any example? &amp;nbsp; regards, &amp;nbsp; Sush
&lt;br&gt;&amp;gt; 
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;---------------------------------------------------------------------
&lt;br&gt;To unsubscribe from this list, please visit:
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://xircles.codehaus.org/manage_email&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://xircles.codehaus.org/manage_email&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/jMock---User-f2665.html&quot; embed=&quot;fixTarget[2665]&quot; target=&quot;_top&quot; &gt;jMock - User&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/writing-test-case-for-struts-action--tp19505143p19508326.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19505143</id>
	<title>writing test case for struts action?</title>
	<published>2008-09-15T21:21:22Z</published>
	<updated>2008-09-15T21:21:22Z</updated>
	<author>
		<name>Sushil Dodake</name>
	</author>
	<content type="html">&lt;div dir=&quot;ltr&quot;&gt;&lt;div&gt;Hi All,&lt;/div&gt;
&lt;div&gt;i am trying to write a test case for a struts action call.&lt;/div&gt;
&lt;div&gt;in the action call i am trying to send a file on the response output stream.&lt;/div&gt;
&lt;div&gt;when i get the output stream using response.getOutputstream i get a object of ServletOurtputStream.&lt;/div&gt;
&lt;div&gt;which is a abstract class..&lt;/div&gt;
&lt;div&gt;&amp;nbsp;i then write a byte stream on the output stream and fluch it to close &lt;/div&gt;
&lt;div&gt;i am confused as to how to write a test case.&lt;/div&gt;
&lt;div&gt;can sombody help me here?&lt;/div&gt;
&lt;div&gt;any example?&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;regards,&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;Sush&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/jMock---User-f2665.html&quot; embed=&quot;fixTarget[2665]&quot; target=&quot;_top&quot; &gt;jMock - User&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/writing-test-case-for-struts-action--tp19505143p19505143.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19500882</id>
	<title>[jira] Updated: (JMOCK-203) CardinalityClause does not include new oneOf method</title>
	<published>2008-09-15T13:36:48Z</published>
	<updated>2008-09-15T13:36:48Z</updated>
	<author>
		<name>JIRA jira@codehaus.org</name>
	</author>
	<content type="html">&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;[ &lt;a href=&quot;http://jira.codehaus.org/browse/JMOCK-203?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://jira.codehaus.org/browse/JMOCK-203?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel&lt;/a&gt;&amp;nbsp;]
&lt;br&gt;&lt;br&gt;Nat Pryce updated JMOCK-203:
&lt;br&gt;----------------------------
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; Fix Version/s: 2.6.0
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; CardinalityClause does not include new oneOf method
&lt;br&gt;&amp;gt; ---------------------------------------------------
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Key: JMOCK-203
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; URL: &lt;a href=&quot;http://jira.codehaus.org/browse/JMOCK-203&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://jira.codehaus.org/browse/JMOCK-203&lt;/a&gt;&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Project: jMock
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Issue Type: Bug
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Components: Library
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;Affects Versions: 2.5.0, 2.5.1
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Reporter: Justin Wesley
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Priority: Minor
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Fix For: 2.6.0
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; The CardinalityClause interface should have the 'oneOf' method since the 'one' method is expected to be deprecated according to the documentation in Expectations. These methods should also be annotated as deprecated.
&lt;/div&gt;&lt;br&gt;-- 
&lt;br&gt;This message is automatically generated by JIRA.
&lt;br&gt;-
&lt;br&gt;If you think it was sent incorrectly contact one of the administrators: &lt;a href=&quot;http://jira.codehaus.org/secure/Administrators.jspa&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://jira.codehaus.org/secure/Administrators.jspa&lt;/a&gt;&lt;br&gt;-
&lt;br&gt;For more information on JIRA, see: &lt;a href=&quot;http://www.atlassian.com/software/jira&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.atlassian.com/software/jira&lt;/a&gt;&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&lt;br&gt;&lt;br&gt;---------------------------------------------------------------------
&lt;br&gt;To unsubscribe from this list, please visit:
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://xircles.codehaus.org/manage_email&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://xircles.codehaus.org/manage_email&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/jMock---Dev-f2664.html&quot; embed=&quot;fixTarget[2664]&quot; target=&quot;_top&quot; &gt;jMock - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/-jira--Created%3A-%28JMOCK-203%29-CardinalityClause-does-not-include-new-oneOf-method-tp19496514p19500882.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19500568</id>
	<title>[jira] Resolved: (JMOCK-203) CardinalityClause does not include new oneOf method</title>
	<published>2008-09-15T13:34:48Z</published>
	<updated>2008-09-15T13:34:48Z</updated>
	<author>
		<name>JIRA jira@codehaus.org</name>
	</author>
	<content type="html">&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;[ &lt;a href=&quot;http://jira.codehaus.org/browse/JMOCK-203?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://jira.codehaus.org/browse/JMOCK-203?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel&lt;/a&gt;&amp;nbsp;]
&lt;br&gt;&lt;br&gt;Nat Pryce resolved JMOCK-203.
&lt;br&gt;-----------------------------
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; Resolution: Fixed
&lt;br&gt;&lt;br&gt;Fix committed to SVN.
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; CardinalityClause does not include new oneOf method
&lt;br&gt;&amp;gt; ---------------------------------------------------
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Key: JMOCK-203
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; URL: &lt;a href=&quot;http://jira.codehaus.org/browse/JMOCK-203&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://jira.codehaus.org/browse/JMOCK-203&lt;/a&gt;&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Project: jMock
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Issue Type: Bug
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Components: Library
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;Affects Versions: 2.5.0, 2.5.1
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Reporter: Justin Wesley
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Priority: Minor
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; The CardinalityClause interface should have the 'oneOf' method since the 'one' method is expected to be deprecated according to the documentation in Expectations. These methods should also be annotated as deprecated.
&lt;/div&gt;&lt;br&gt;-- 
&lt;br&gt;This message is automatically generated by JIRA.
&lt;br&gt;-
&lt;br&gt;If you think it was sent incorrectly contact one of the administrators: &lt;a href=&quot;http://jira.codehaus.org/secure/Administrators.jspa&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://jira.codehaus.org/secure/Administrators.jspa&lt;/a&gt;&lt;br&gt;-
&lt;br&gt;For more information on JIRA, see: &lt;a href=&quot;http://www.atlassian.com/software/jira&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.atlassian.com/software/jira&lt;/a&gt;&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&lt;br&gt;&lt;br&gt;---------------------------------------------------------------------
&lt;br&gt;To unsubscribe from this list, please visit:
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://xircles.codehaus.org/manage_email&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://xircles.codehaus.org/manage_email&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/jMock---Dev-f2664.html&quot; embed=&quot;fixTarget[2664]&quot; target=&quot;_top&quot; &gt;jMock - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/-jira--Created%3A-%28JMOCK-203%29-CardinalityClause-does-not-include-new-oneOf-method-tp19496514p19500568.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19500570</id>
	<title>[jira] Updated: (JMOCK-203) CardinalityClause does not include new oneOf method</title>
	<published>2008-09-15T13:34:48Z</published>
	<updated>2008-09-15T13:34:48Z</updated>
	<author>
		<name>JIRA jira@codehaus.org</name>
	</author>
	<content type="html">&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;[ &lt;a href=&quot;http://jira.codehaus.org/browse/JMOCK-203?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://jira.codehaus.org/browse/JMOCK-203?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel&lt;/a&gt;&amp;nbsp;]
&lt;br&gt;&lt;br&gt;Nat Pryce updated JMOCK-203:
&lt;br&gt;----------------------------
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; Description: 
&lt;br&gt;The CardinalityClause interface should have the 'oneOf' method since the 'one' method is expected to be deprecated according to the documentation in Expectations. These methods should also be annotated as deprecated.
&lt;br&gt;&lt;br&gt;&lt;br&gt;&amp;nbsp; was:
&lt;br&gt;The CardinalityClause interface should have the 'oneOf' method since the 'one' method is expected to be deprecated according to the documentation in Expectations. These methods should also be annotated as deprecated.
&lt;br&gt;&lt;br&gt;The documentation should also be changed to reflect this change in API. I noticed 'one' is referenced in the sections 'Getting Started', 'Cookbook', and 'Cheat Sheet'.
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; Component/s: &amp;nbsp; &amp;nbsp; (was: Documentation)
&lt;br&gt;&lt;br&gt;Moved documentation issues into their own Jira issue
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; CardinalityClause does not include new oneOf method
&lt;br&gt;&amp;gt; ---------------------------------------------------
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Key: JMOCK-203
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; URL: &lt;a href=&quot;http://jira.codehaus.org/browse/JMOCK-203&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://jira.codehaus.org/browse/JMOCK-203&lt;/a&gt;&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Project: jMock
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Issue Type: Bug
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Components: Library
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;Affects Versions: 2.5.0, 2.5.1
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Reporter: Justin Wesley
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Priority: Minor
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; The CardinalityClause interface should have the 'oneOf' method since the 'one' method is expected to be deprecated according to the documentation in Expectations. These methods should also be annotated as deprecated.
&lt;/div&gt;&lt;br&gt;-- 
&lt;br&gt;This message is automatically generated by JIRA.
&lt;br&gt;-
&lt;br&gt;If you think it was sent incorrectly contact one of the administrators: &lt;a href=&quot;http://jira.codehaus.org/secure/Administrators.jspa&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://jira.codehaus.org/secure/Administrators.jspa&lt;/a&gt;&lt;br&gt;-
&lt;br&gt;For more information on JIRA, see: &lt;a href=&quot;http://www.atlassian.com/software/jira&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.atlassian.com/software/jira&lt;/a&gt;&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&lt;br&gt;&lt;br&gt;---------------------------------------------------------------------
&lt;br&gt;To unsubscribe from this list, please visit:
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://xircles.codehaus.org/manage_email&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://xircles.codehaus.org/manage_email&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/jMock---Dev-f2664.html&quot; embed=&quot;fixTarget[2664]&quot; target=&quot;_top&quot; &gt;jMock - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/-jira--Created%3A-%28JMOCK-203%29-CardinalityClause-does-not-include-new-oneOf-method-tp19496514p19500570.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19500586</id>
	<title>[jira] Created: (JMOCK-205) Deprecate the 'one' method in favour of 'oneOf'</title>
	<published>2008-09-15T13:34:48Z</published>
	<updated>2008-09-15T13:34:48Z</updated>
	<author>
		<name>JIRA jira@codehaus.org</name>
	</author>
	<content type="html">Deprecate the 'one' method in favour of 'oneOf'
&lt;br&gt;-----------------------------------------------
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Key: JMOCK-205
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;URL: &lt;a href=&quot;http://jira.codehaus.org/browse/JMOCK-205&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://jira.codehaus.org/browse/JMOCK-205&lt;/a&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Project: jMock
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Issue Type: New Feature
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Components: Library
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Reporter: Nat Pryce
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Priority: Trivial
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;This message is automatically generated by JIRA.
&lt;br&gt;-
&lt;br&gt;If you think it was sent incorrectly contact one of the administrators: &lt;a href=&quot;http://jira.codehaus.org/secure/Administrators.jspa&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://jira.codehaus.org/secure/Administrators.jspa&lt;/a&gt;&lt;br&gt;-
&lt;br&gt;For more information on JIRA, see: &lt;a href=&quot;http://www.atlassian.com/software/jira&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.atlassian.com/software/jira&lt;/a&gt;&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&lt;br&gt;&lt;br&gt;---------------------------------------------------------------------
&lt;br&gt;To unsubscribe from this list, please visit:
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://xircles.codehaus.org/manage_email&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://xircles.codehaus.org/manage_email&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/jMock---Dev-f2664.html&quot; embed=&quot;fixTarget[2664]&quot; target=&quot;_top&quot; &gt;jMock - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/-jira--Created%3A-%28JMOCK-205%29-Deprecate-the-%27one%27-method-in-favour-of-%27oneOf%27-tp19500586p19500586.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19500534</id>
	<title>[jira] Updated: (JMOCK-204) Documentation does not use the oneOf method</title>
	<published>2008-09-15T13:32:48Z</published>
	<updated>2008-09-15T13:32:48Z</updated>
	<author>
		<name>JIRA jira@codehaus.org</name>
	</author>
	<content type="html">&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;[ &lt;a href=&quot;http://jira.codehaus.org/browse/JMOCK-204?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://jira.codehaus.org/browse/JMOCK-204?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel&lt;/a&gt;&amp;nbsp;]
&lt;br&gt;&lt;br&gt;Nat Pryce updated JMOCK-204:
&lt;br&gt;----------------------------
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Description: The documentation should also be changed to reflect that &amp;quot;oneOf&amp;quot; is preferred to &amp;quot;one&amp;quot;. I noticed 'one' is referenced in the sections 'Getting Started', 'Cookbook', and 'Cheat Sheet'. &amp;nbsp;(was: The CardinalityClause interface should have the 'oneOf' method since the 'one' method is expected to be deprecated according to the documentation in Expectations. These methods should also be annotated as deprecated.
&lt;br&gt;&lt;br&gt;The documentation should also be changed to reflect this change in API. I noticed 'one' is referenced in the sections 'Getting Started', 'Cookbook', and 'Cheat Sheet'.)
&lt;br&gt;&amp;nbsp; &amp;nbsp; Affects Version/s: &amp;nbsp; &amp;nbsp; (was: 2.5.1)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(was: 2.5.0)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Chore (ASAP)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Fix Version/s: Chore (ASAP)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Component/s: &amp;nbsp; &amp;nbsp; (was: Library)
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Documentation does not use the oneOf method
&lt;br&gt;&amp;gt; -------------------------------------------
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Key: JMOCK-204
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; URL: &lt;a href=&quot;http://jira.codehaus.org/browse/JMOCK-204&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://jira.codehaus.org/browse/JMOCK-204&lt;/a&gt;&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Project: jMock
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Issue Type: Bug
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Components: Documentation
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;Affects Versions: Chore (ASAP)
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Reporter: Justin Wesley
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Priority: Minor
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Fix For: Chore (ASAP)
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; The documentation should also be changed to reflect that &amp;quot;oneOf&amp;quot; is preferred to &amp;quot;one&amp;quot;. I noticed 'one' is referenced in the sections 'Getting Started', 'Cookbook', and 'Cheat Sheet'.
&lt;/div&gt;&lt;br&gt;-- 
&lt;br&gt;This message is automatically generated by JIRA.
&lt;br&gt;-
&lt;br&gt;If you think it was sent incorrectly contact one of the administrators: &lt;a href=&quot;http://jira.codehaus.org/secure/Administrators.jspa&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://jira.codehaus.org/secure/Administrators.jspa&lt;/a&gt;&lt;br&gt;-
&lt;br&gt;For more information on JIRA, see: &lt;a href=&quot;http://www.atlassian.com/software/jira&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.atlassian.com/software/jira&lt;/a&gt;&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&lt;br&gt;&lt;br&gt;---------------------------------------------------------------------
&lt;br&gt;To unsubscribe from this list, please visit:
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://xircles.codehaus.org/manage_email&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://xircles.codehaus.org/manage_email&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/jMock---Dev-f2664.html&quot; embed=&quot;fixTarget[2664]&quot; target=&quot;_top&quot; &gt;jMock - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/-jira--Created%3A-%28JMOCK-204%29-Documentation-does-not-use-the-oneOf-method-tp19500523p19500534.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19500523</id>
	<title>[jira] Created: (JMOCK-204) Documentation does not use the oneOf method</title>
	<published>2008-09-15T13:30:48Z</published>
	<updated>2008-09-15T13:30:48Z</updated>
	<author>
		<name>JIRA jira@codehaus.org</name>
	</author>
	<content type="html">Documentation does not use the oneOf method
&lt;br&gt;-------------------------------------------
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Key: JMOCK-204
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;URL: &lt;a href=&quot;http://jira.codehaus.org/browse/JMOCK-204&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://jira.codehaus.org/browse/JMOCK-204&lt;/a&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Project: jMock
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Issue Type: Bug
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Components: Documentation, Library
&lt;br&gt;&amp;nbsp; &amp;nbsp; Affects Versions: 2.5.0, 2.5.1
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Reporter: Justin Wesley
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Priority: Minor
&lt;br&gt;&lt;br&gt;&lt;br&gt;The CardinalityClause interface should have the 'oneOf' method since the 'one' method is expected to be deprecated according to the documentation in Expectations. These methods should also be annotated as deprecated.
&lt;br&gt;&lt;br&gt;The documentation should also be changed to reflect this change in API. I noticed 'one' is referenced in the sections 'Getting Started', 'Cookbook', and 'Cheat Sheet'.
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;This message is automatically generated by JIRA.
&lt;br&gt;-
&lt;br&gt;If you think it was sent incorrectly contact one of the administrators: &lt;a href=&quot;http://jira.codehaus.org/secure/Administrators.jspa&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://jira.codehaus.org/secure/Administrators.jspa&lt;/a&gt;&lt;br&gt;-
&lt;br&gt;For more information on JIRA, see: &lt;a href=&quot;http://www.atlassian.com/software/jira&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.atlassian.com/software/jira&lt;/a&gt;&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&lt;br&gt;&lt;br&gt;---------------------------------------------------------------------
&lt;br&gt;To unsubscribe from this list, please visit:
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://xircles.codehaus.org/manage_email&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://xircles.codehaus.org/manage_email&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/jMock---Dev-f2664.html&quot; embed=&quot;fixTarget[2664]&quot; target=&quot;_top&quot; &gt;jMock - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/-jira--Created%3A-%28JMOCK-204%29-Documentation-does-not-use-the-oneOf-method-tp19500523p19500523.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19500487</id>
	<title>[jira] Updated: (JMOCK-202) Unsatisfied expectations are not correctly captured with JUnit4's @Test(expected=AssertionError.class) in JMock 2.5.0-RC1+</title>
	<published>2008-09-15T13:28:48Z</published>
	<updated>2008-09-15T13:28:48Z</updated>
	<author>
		<name>JIRA jira@codehaus.org</name>
	</author>
	<content type="html">&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;[ &lt;a href=&quot;http://jira.codehaus.org/browse/JMOCK-202?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://jira.codehaus.org/browse/JMOCK-202?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel&lt;/a&gt;&amp;nbsp;]
&lt;br&gt;&lt;br&gt;Nat Pryce updated JMOCK-202:
&lt;br&gt;----------------------------
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; Component/s: Library
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Unsatisfied expectations are not correctly captured with JUnit4's @Test(expected=AssertionError.class) in JMock 2.5.0-RC1+
&lt;br&gt;&amp;gt; --------------------------------------------------------------------------------------------------------------------------
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Key: JMOCK-202
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; URL: &lt;a href=&quot;http://jira.codehaus.org/browse/JMOCK-202&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://jira.codehaus.org/browse/JMOCK-202&lt;/a&gt;&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Project: jMock
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Issue Type: Bug
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Components: Library
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;Affects Versions: 2.5.0-RC1, 2.5.0, 2.5.1
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Environment: JMock 2.5.0-RC1+
&lt;br&gt;&amp;gt; JUnit 4.4
&lt;br&gt;&amp;gt; Java 1.5.0_16
&lt;br&gt;&amp;gt; Ubuntu Linux 8.0.4
&lt;br&gt;&amp;gt; kernel 2.6.24-19-generic
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Reporter: Steven Cummings
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Attachments: JMockBugTest.java
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; This was working up through version 2.4.0. I am testing some custom matchers with JMock by writing expectations that I expect to be unsatisfied when the test completes, and therefore I expect an AssertionError. From JMock 2.5.0-RC1 and on, @RunWith(JMock.class) causes @Test(expected=AssertionError.class) to fail to capture the resulting exception.
&lt;br&gt;&amp;gt; When I say JMock 2.5.0-RC1+, I mean I could reproduce the problem with versions 2.5.0-RC1, 2.5.0, 2.5.0.1, and 2.5.1.
&lt;/div&gt;&lt;br&gt;-- 
&lt;br&gt;This message is automatically generated by JIRA.
&lt;br&gt;-
&lt;br&gt;If you think it was sent incorrectly contact one of the administrators: &lt;a href=&quot;http://jira.codehaus.org/secure/Administrators.jspa&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://jira.codehaus.org/secure/Administrators.jspa&lt;/a&gt;&lt;br&gt;-
&lt;br&gt;For more information on JIRA, see: &lt;a href=&quot;http://www.atlassian.com/software/jira&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.atlassian.com/software/jira&lt;/a&gt;&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&lt;br&gt;&lt;br&gt;---------------------------------------------------------------------
&lt;br&gt;To unsubscribe from this list, please visit:
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://xircles.codehaus.org/manage_email&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://xircles.codehaus.org/manage_email&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/jMock---Dev-f2664.html&quot; embed=&quot;fixTarget[2664]&quot; target=&quot;_top&quot; &gt;jMock - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/-jira--Created%3A-%28JMOCK-202%29-Unsatisfied-expectations-are-not-correctly-captured-with-JUnit4%27s-%40Test%28expected%3DAssertionError.class%29-in-JMock-2.5.0-RC1%2B-tp19275677p19500487.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19498860</id>
	<title>[jira] Commented: (JMOCK-203) CardinalityClause does not include new oneOf method</title>
	<published>2008-09-15T11:28:48Z</published>
	<updated>2008-09-15T11:28:48Z</updated>
	<author>
		<name>JIRA jira@codehaus.org</name>
	</author>
	<content type="html">&lt;br&gt;&amp;nbsp; &amp;nbsp; [ &lt;a href=&quot;http://jira.codehaus.org/browse/JMOCK-203?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&amp;focusedCommentId=148011#action_148011&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://jira.codehaus.org/browse/JMOCK-203?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&amp;focusedCommentId=148011#action_148011&lt;/a&gt;&amp;nbsp;] 
&lt;br&gt;&lt;br&gt;Nat Pryce commented on JMOCK-203:
&lt;br&gt;---------------------------------
&lt;br&gt;&lt;br&gt;Good point! &amp;nbsp;The one method is not deprecated yet, but will be in a future release.
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; CardinalityClause does not include new oneOf method
&lt;br&gt;&amp;gt; ---------------------------------------------------
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Key: JMOCK-203
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; URL: &lt;a href=&quot;http://jira.codehaus.org/browse/JMOCK-203&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://jira.codehaus.org/browse/JMOCK-203&lt;/a&gt;&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Project: jMock
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Issue Type: Bug
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Components: Documentation, Library
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;Affects Versions: 2.5.0, 2.5.1
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Reporter: Justin Wesley
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Priority: Minor
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; The CardinalityClause interface should have the 'oneOf' method since the 'one' method is expected to be deprecated according to the documentation in Expectations. These methods should also be annotated as deprecated.
&lt;br&gt;&amp;gt; The documentation should also be changed to reflect this change in API. I noticed 'one' is referenced in the sections 'Getting Started', 'Cookbook', and 'Cheat Sheet'.
&lt;/div&gt;&lt;br&gt;-- 
&lt;br&gt;This message is automatically generated by JIRA.
&lt;br&gt;-
&lt;br&gt;If you think it was sent incorrectly contact one of the administrators: &lt;a href=&quot;http://jira.codehaus.org/secure/Administrators.jspa&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://jira.codehaus.org/secure/Administrators.jspa&lt;/a&gt;&lt;br&gt;-
&lt;br&gt;For more information on JIRA, see: &lt;a href=&quot;http://www.atlassian.com/software/jira&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.atlassian.com/software/jira&lt;/a&gt;&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&lt;br&gt;&lt;br&gt;---------------------------------------------------------------------
&lt;br&gt;To unsubscribe from this list, please visit:
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://xircles.codehaus.org/manage_email&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://xircles.codehaus.org/manage_email&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/jMock---Dev-f2664.html&quot; embed=&quot;fixTarget[2664]&quot; target=&quot;_top&quot; &gt;jMock - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/-jira--Created%3A-%28JMOCK-203%29-CardinalityClause-does-not-include-new-oneOf-method-tp19496514p19498860.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19496514</id>
	<title>[jira] Created: (JMOCK-203) CardinalityClause does not include new oneOf method</title>
	<published>2008-09-15T09:24:48Z</published>
	<updated>2008-09-15T09:24:48Z</updated>
	<author>
		<name>JIRA jira@codehaus.org</name>
	</author>
	<content type="html">CardinalityClause does not include new oneOf method
&lt;br&gt;---------------------------------------------------
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Key: JMOCK-203
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;URL: &lt;a href=&quot;http://jira.codehaus.org/browse/JMOCK-203&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://jira.codehaus.org/browse/JMOCK-203&lt;/a&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Project: jMock
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Issue Type: Bug
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Components: Documentation, Library
&lt;br&gt;&amp;nbsp; &amp;nbsp; Affects Versions: 2.5.1, 2.5.0
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Reporter: Justin Wesley
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Priority: Minor
&lt;br&gt;&lt;br&gt;&lt;br&gt;The CardinalityClause interface should have the 'oneOf' method since the 'one' method is expected to be deprecated according to the documentation in Expectations. These methods should also be annotated as deprecated.
&lt;br&gt;&lt;br&gt;The documentation should also be changed to reflect this change in API. I noticed 'one' is referenced in the sections 'Getting Started', 'Cookbook', and 'Cheat Sheet'.
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;This message is automatically generated by JIRA.
&lt;br&gt;-
&lt;br&gt;If you think it was sent incorrectly contact one of the administrators: &lt;a href=&quot;http://jira.codehaus.org/secure/Administrators.jspa&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://jira.codehaus.org/secure/Administrators.jspa&lt;/a&gt;&lt;br&gt;-
&lt;br&gt;For more information on JIRA, see: &lt;a href=&quot;http://www.atlassian.com/software/jira&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.atlassian.com/software/jira&lt;/a&gt;&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&lt;br&gt;&lt;br&gt;---------------------------------------------------------------------
&lt;br&gt;To unsubscribe from this list, please visit:
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://xircles.codehaus.org/manage_email&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://xircles.codehaus.org/manage_email&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/jMock---Dev-f2664.html&quot; embed=&quot;fixTarget[2664]&quot; target=&quot;_top&quot; &gt;jMock - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/-jira--Created%3A-%28JMOCK-203%29-CardinalityClause-does-not-include-new-oneOf-method-tp19496514p19496514.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19479062</id>
	<title>Re: Can I mock an enum</title>
	<published>2008-09-14T03:30:49Z</published>
	<updated>2008-09-14T03:30:49Z</updated>
	<author>
		<name>Nat Pryce</name>
	</author>
	<content type="html">Enums can implement interfaces, so you can define an interface that
&lt;br&gt;defines how an object using an enum type interacts with instances of
&lt;br&gt;that enum, and then mock the interface.
&lt;br&gt;&lt;br&gt;As someone else pointed out, enum classes are final and so you can't
&lt;br&gt;mock them. &amp;nbsp;However, the jDave project has an &amp;quot;unfinalizer&amp;quot; that you
&lt;br&gt;can use to remove final-ness from classes as they are loaded into the
&lt;br&gt;JVM. &amp;nbsp;With that, you can use the ClassImposteriser to mock final
&lt;br&gt;classes. &amp;nbsp;However, reaching for that kind of magic is a clear smell
&lt;br&gt;that something is not quite right with your design.
&lt;br&gt;&lt;br&gt;--Nat
&lt;br&gt;&lt;br&gt;2008/9/12 Avinash Nayak &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19479062&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;avi_gaming@...&lt;/a&gt;&amp;gt;:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; I was trying to write testcases for a method which takes an enum as parameter.
&lt;br&gt;&amp;gt; I dont want to pass any particular value to it.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; This enum also contains a few methods that i want to mock.
&lt;br&gt;&amp;gt; Is there any way to do so?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Please let me know if my question is not clear.
&lt;br&gt;&amp;gt; I will try to post a sample then.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Thanks,
&lt;br&gt;&amp;gt; Avinash
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; ---------------------------------------------------------------------
&lt;br&gt;&amp;gt; To unsubscribe from this list, please visit:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;&lt;a href=&quot;http://xircles.codehaus.org/manage_email&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://xircles.codehaus.org/manage_email&lt;/a&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;/div&gt;&lt;br&gt;---------------------------------------------------------------------
&lt;br&gt;To unsubscribe from this list, please visit:
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://xircles.codehaus.org/manage_email&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://xircles.codehaus.org/manage_email&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/jMock---User-f2665.html&quot; embed=&quot;fixTarget[2665]&quot; target=&quot;_top&quot; &gt;jMock - User&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/Can-I-mock-an-enum-tp19453690p19479062.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19468460</id>
	<title>Re: Can I mock an enum</title>
	<published>2008-09-13T01:19:21Z</published>
	<updated>2008-09-13T01:19:21Z</updated>
	<author>
		<name>Avinash Nayak</name>
	</author>
	<content type="html">First of all, the code snippet was just to convey my message.
&lt;br&gt;The method i want to test depends on Strategy.getValue().
&lt;br&gt;Though its a simple Boolean here. it may not be the case also.
&lt;br&gt;So while testing myMethod() I could ensure it uses only getValue method
&lt;br&gt;&amp;nbsp;out of Strategy class.
&lt;br&gt;And I could have mocked the returnValue and go ahead with the test.
&lt;br&gt;&lt;br&gt;Otherwise, I would have to test the given method by 
&lt;br&gt;&amp;nbsp;passing all the enum values out of Strategy Enum.
&lt;br&gt;Passing for a single enum value, doesnt say the test has succeeded.
&lt;br&gt;And there might be case that i have 10-12 values in the enum.
&lt;br&gt;&lt;br&gt;Anyway, it was nice to see some good comments... :)
&lt;br&gt;&lt;br&gt;Thanks again.
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;---------------------------------------------------------------------
&lt;br&gt;To unsubscribe from this list, please visit:
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://xircles.codehaus.org/manage_email&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://xircles.codehaus.org/manage_email&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/jMock---User-f2665.html&quot; embed=&quot;fixTarget[2665]&quot; target=&quot;_top&quot; &gt;jMock - User&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/Can-I-mock-an-enum-tp19453690p19468460.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19468293</id>
	<title>Re: Re: Can I mock an enum</title>
	<published>2008-09-13T00:52:03Z</published>
	<updated>2008-09-13T00:52:03Z</updated>
	<author>
		<name>Steve Freeman-2</name>
	</author>
	<content type="html">You should be using mocks to test interactions with neighbouring &amp;nbsp;
&lt;br&gt;objects that represent &amp;quot;interesting&amp;quot; behaviour. For simple value &amp;nbsp;
&lt;br&gt;objects which includes simple value objects, I'd just use a real one. &amp;nbsp;
&lt;br&gt;Either the Strategy makes a difference to the behaviour of the unit &amp;nbsp;
&lt;br&gt;tested code, in which case you want to test the effect, or it doesn't, &amp;nbsp;
&lt;br&gt;in which case any of the values will work.
&lt;br&gt;&lt;br&gt;See also
&lt;br&gt;&lt;br&gt;&lt;a href=&quot;http://www.mockobjects.com/2007/04/test-smell-everything-is-mocked.html&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.mockobjects.com/2007/04/test-smell-everything-is-mocked.html&lt;/a&gt;&lt;br&gt;&lt;br&gt;S.
&lt;br&gt;&lt;br&gt;&lt;br&gt;On 13 Sep 2008, at 07:41, Avinash wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; I got what you guys saying.
&lt;br&gt;&amp;gt; Understood the fact that the enums are final
&lt;br&gt;&amp;gt; and hence cant mock them using jmock rather with &amp;nbsp;
&lt;br&gt;&amp;gt; ClasssImposteriser.INSTANCE.
&lt;br&gt;&amp;gt; Still will try to convince what i was trying to achieve.
&lt;br&gt;&amp;gt; I am posting a code snippet. this is quite simple version of my code.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; public enum Strategy {
&lt;br&gt;&amp;gt; 	StrategyTrue(Boolean.TRUE), StrategyFalse(Boolean.FALSE), &amp;nbsp;
&lt;br&gt;&amp;gt; StrategyNone(null);
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; 	private Boolean value;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; 	private Strategy(Boolean value) {
&lt;br&gt;&amp;gt; 		this.value = value;
&lt;br&gt;&amp;gt; 	}
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; 	public Boolean getValue() {
&lt;br&gt;&amp;gt; 		return value;
&lt;br&gt;&amp;gt; 	}
&lt;br&gt;&amp;gt; }
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; public class MyClass {
&lt;br&gt;&amp;gt; 	public Boolean myMethod(Strategy strategy) {
&lt;br&gt;&amp;gt; 		return strategy.getValue();
&lt;br&gt;&amp;gt; 	}
&lt;br&gt;&amp;gt; }
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; public class MyClassUTEST extends TestCase {
&lt;br&gt;&amp;gt; 	public void test_myMethod() {
&lt;br&gt;&amp;gt; 		// Mocked Value;
&lt;br&gt;&amp;gt; 		final Boolean mockedValue = Boolean.TRUE;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; 		Mockery context = new Mockery();
&lt;br&gt;&amp;gt; 		context.setImposteriser(ClassImposteriser.INSTANCE);
&lt;br&gt;&amp;gt; 		final Strategy strategy = context.mock(Strategy.class);
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; 		context.checking(new Expectations() {
&lt;br&gt;&amp;gt; 			{
&lt;br&gt;&amp;gt; 				oneOf(strategy).getValue();
&lt;br&gt;&amp;gt; 				will(returnValue(mockedValue));
&lt;br&gt;&amp;gt; 			}
&lt;br&gt;&amp;gt; 		});
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; 		assertEquals(mockedValue, new MyClass().myMethod(strategy));
&lt;br&gt;&amp;gt; 		context.assertIsSatisfied();
&lt;br&gt;&amp;gt; 	}
&lt;br&gt;&amp;gt; }
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; This way a single testcase can cover all the test scenarios of the &amp;nbsp;
&lt;br&gt;&amp;gt; method.
&lt;br&gt;&amp;gt; Otherwise, i would have to write test for each Enum value.
&lt;br&gt;&amp;gt; I could make it work by changing the enum in the following way.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; public enum Strategy {
&lt;br&gt;&amp;gt; 	StrategyTrue() {
&lt;br&gt;&amp;gt; 		@Override
&lt;br&gt;&amp;gt; 		public Boolean getValue() {
&lt;br&gt;&amp;gt; 			return Boolean.TRUE;
&lt;br&gt;&amp;gt; 		}
&lt;br&gt;&amp;gt; 	},
&lt;br&gt;&amp;gt; 	StrategyFalse() {
&lt;br&gt;&amp;gt; 		@Override
&lt;br&gt;&amp;gt; 		public Boolean getValue() {
&lt;br&gt;&amp;gt; 			return Boolean.FALSE;
&lt;br&gt;&amp;gt; 		}
&lt;br&gt;&amp;gt; 	},
&lt;br&gt;&amp;gt; 	StrategyNone() {
&lt;br&gt;&amp;gt; 		@Override
&lt;br&gt;&amp;gt; 		public Boolean getValue() {
&lt;br&gt;&amp;gt; 			return null;
&lt;br&gt;&amp;gt; 		}
&lt;br&gt;&amp;gt; 	};
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; 	public abstract Boolean getValue();
&lt;br&gt;&amp;gt; }
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; But still, i would have appreciated the first attempt.
&lt;/div&gt;&lt;br&gt;Steve Freeman
&lt;br&gt;Winner of the Agile Alliance Gordon Pask award 2006
&lt;br&gt;&lt;br&gt;&lt;a href=&quot;http://www.m3p.co.uk&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.m3p.co.uk&lt;/a&gt;&lt;br&gt;&lt;br&gt;M3P Limited.
&lt;br&gt;Registered office. 2 Church Street, Burnham, Bucks, SL1 7HZ.
&lt;br&gt;Company registered in England &amp; Wales. Number 03689627
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;---------------------------------------------------------------------
&lt;br&gt;To unsubscribe from this list, please visit:
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://xircles.codehaus.org/manage_email&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://xircles.codehaus.org/manage_email&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/jMock---User-f2665.html&quot; embed=&quot;fixTarget[2665]&quot; target=&quot;_top&quot; &gt;jMock - User&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/Can-I-mock-an-enum-tp19453690p19468293.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19467983</id>
	<title>Re: Can I mock an enum</title>
	<published>2008-09-12T23:41:07Z</published>
	<updated>2008-09-12T23:41:07Z</updated>
	<author>
		<name>Avinash Nayak</name>
	</author>
	<content type="html">I got what you guys saying.
&lt;br&gt;Understood the fact that the enums are final
&lt;br&gt;&amp;nbsp;and hence cant mock them using jmock rather with ClasssImposteriser.INSTANCE.
&lt;br&gt;Still will try to convince what i was trying to achieve.
&lt;br&gt;I am posting a code snippet. this is quite simple version of my code.
&lt;br&gt;&lt;br&gt;public enum Strategy {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; StrategyTrue(Boolean.TRUE), StrategyFalse(Boolean.FALSE), StrategyNone(null);
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; private Boolean value;
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; private Strategy(Boolean value) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; this.value = value;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public Boolean getValue() {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return value;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;}
&lt;br&gt;&lt;br&gt;public class MyClass {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public Boolean myMethod(Strategy strategy) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return strategy.getValue();
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;}
&lt;br&gt;&lt;br&gt;public class MyClassUTEST extends TestCase {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public void test_myMethod() {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Mocked Value;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; final Boolean mockedValue = Boolean.TRUE;
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Mockery context = new Mockery();
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; context.setImposteriser(ClassImposteriser.INSTANCE);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; final Strategy strategy = context.mock(Strategy.class);
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; context.checking(new Expectations() {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; oneOf(strategy).getValue();
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; will(returnValue(mockedValue));
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; });
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; assertEquals(mockedValue, new MyClass().myMethod(strategy));
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; context.assertIsSatisfied();
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;}
&lt;br&gt;&lt;br&gt;This way a single testcase can cover all the test scenarios of the method.
&lt;br&gt;Otherwise, i would have to write test for each Enum value.
&lt;br&gt;I could make it work by changing the enum in the following way.
&lt;br&gt;&lt;br&gt;public enum Strategy {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; StrategyTrue() {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @Override
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public Boolean getValue() {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return Boolean.TRUE;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; },
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; StrategyFalse() {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @Override
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public Boolean getValue() {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &