<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent changes to feature-requests</title><link href="https://sourceforge.net/p/mockobjects/feature-requests/" rel="alternate"/><link href="https://sourceforge.net/p/mockobjects/feature-requests/feed.atom" rel="self"/><id>https://sourceforge.net/p/mockobjects/feature-requests/</id><updated>2004-01-15T11:15:41Z</updated><subtitle>Recent changes to feature-requests</subtitle><entry><title>provide an expectMultiple() type method?</title><link href="https://sourceforge.net/p/mockobjects/feature-requests/5/" rel="alternate"/><published>2004-01-15T11:15:41Z</published><updated>2004-01-15T11:15:41Z</updated><author><name>Keith Quint</name><uri>https://sourceforge.net/u/quintk/</uri></author><id>https://sourceforge.net0ae174323db5e9497e1ab4564ed2699a667886ff</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi &lt;/p&gt;
&lt;p&gt;There are a number of times when we expect a method to &lt;br /&gt;
be called and we are not bothered what the arguments are. &lt;br /&gt;
In steps the .expect(object,C.ANY_ARGS) however, there are &lt;br /&gt;
also a number of occasions where we expect a method to be &lt;br /&gt;
called multiple times and we still dont care whats passed &lt;br /&gt;
nor do we actually know how many times its going to be &lt;br /&gt;
called. Ie when we mock the apache.commons.logger we &lt;br /&gt;
may not care what we log or how often. Is it possible to &lt;br /&gt;
create an expectMultiple(object,C.ANY_ARGS) type method? &lt;br /&gt;
You could, if you desired, count the number of calls and &lt;br /&gt;
verify this.&lt;/p&gt;
&lt;p&gt;This is not necessarily a problem in that you could created a &lt;br /&gt;
MockLogger() class instead of using the dynamic mock of the &lt;br /&gt;
Log interface and just implemented each method with stubs.&lt;/p&gt;
&lt;p&gt;Kind regards&lt;br /&gt;
Keith&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Validation of Mock.expect*(..) arguments</title><link href="https://sourceforge.net/p/mockobjects/feature-requests/4/" rel="alternate"/><published>2003-08-22T22:04:35Z</published><updated>2003-08-22T22:04:35Z</updated><author><name>Barry Kaplan</name><uri>https://sourceforge.net/u/barrykaplan/</uri></author><id>https://sourceforge.net4b4c6279f4890d3e8b0d94a112065e9ab12b0be9</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;A very common error in test setup is to define&lt;br /&gt;
expectations for which there never will be match. For&lt;br /&gt;
example, given:&lt;/p&gt;
&lt;p&gt;public interface Foo {&lt;br /&gt;
public void bar(Blob blob);&lt;br /&gt;
}&lt;br /&gt;
...&lt;br /&gt;
// 1. no method tweetle on interface&lt;br /&gt;
mockFoo.expect(&amp;amp;quot;tweetle&amp;amp;quot;, aBlob);&lt;br /&gt;
// 2. no bar method that takes two arguments&lt;br /&gt;
mockFoo.expect(&amp;amp;quot;bar&amp;amp;quot;, C.args(C.eq(aBlob), C.eq(aTweetle)));&lt;br /&gt;
// 3. no bar method that returns a Tweetle&lt;br /&gt;
mockFoo.expectAndReturn(&amp;amp;quot;bar&amp;amp;quot;, aBlob, aTweetle);&lt;br /&gt;
// 4. no bar method that takes a Tweetle argument&lt;br /&gt;
mockFoo.expect(&amp;amp;quot;bar&amp;amp;quot;, C.eq(aTweetle)); &lt;/p&gt;
&lt;p&gt;1, 2, 3 /could/ be done with the current design. It&lt;br /&gt;
just isnt' resulting  strange test executions that&lt;br /&gt;
could have failed immediatly at setup time.&lt;/p&gt;
&lt;p&gt;4 would require some method of &amp;amp;quot;knowing&amp;amp;quot; a constraint's&lt;br /&gt;
type. That is the type of its argument. Of course this&lt;br /&gt;
may not always be possible, but when it is could be&lt;br /&gt;
used to help validate the expectations. &lt;/p&gt;
&lt;p&gt;---&lt;/p&gt;
&lt;p&gt;Comment from Nat on this subject:&lt;/p&gt;
&lt;p&gt;Request 4 is impossible for most constraints (because a&lt;br /&gt;
Constraint has no concept of &amp;amp;quot;type&amp;amp;quot;) unless we extend&lt;br /&gt;
the  Constraint interface with methods that to perform&lt;br /&gt;
early checks.  However, I would rather keep the&lt;br /&gt;
Constraint interface as simple as possible to make it&lt;br /&gt;
trivially easy to write new Constraints.  That approach&lt;br /&gt;
has helped make the&lt;br /&gt;
Constraint concept very easy for new users to&lt;br /&gt;
understand and use, and also kept the Constraint&lt;br /&gt;
interface very stable (it hasn't changed since first&lt;br /&gt;
introduced).&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Add match() to new DynaMock API</title><link href="https://sourceforge.net/p/mockobjects/feature-requests/3/" rel="alternate"/><published>2003-05-16T07:22:31Z</published><updated>2003-05-16T07:22:31Z</updated><author><name>Vincent Massol</name><uri>https://sourceforge.net/u/vmassol/</uri></author><id>https://sourceforge.net1f9154590bc63e8bc8ee6b7c086ef9102fd42c6d</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Here's the use case for a new match():&lt;/p&gt;
&lt;p&gt;I have in my code a call to queueConnection.close() &lt;br /&gt;
(for example). I use a Mock for QueueConnection. If I &lt;br /&gt;
*don't* define either an expect*() or a match*(), I get:&lt;/p&gt;
&lt;p&gt;junit.framework.AssertionFailedError: &lt;br /&gt;
mockQueueConnection: Unexpected call: close() &lt;br /&gt;
Expected no methods&lt;br /&gt;
at com.mockobjects.dynamic.Mock.invoke&lt;br /&gt;
(Mock.java:95)&lt;br /&gt;
[...]&lt;/p&gt;
&lt;p&gt;Which means to me that we have to define the &lt;br /&gt;
behaviour for any method called (and that there is no &lt;br /&gt;
default behaviour assumed). Fine with me. Then, I don't &lt;br /&gt;
want to set an expectation on close() because this &lt;br /&gt;
mock setup is part of a general setup that I want to &lt;br /&gt;
reuse across several tests and some tests do call close&lt;br /&gt;
(), some do not.&lt;/p&gt;
&lt;p&gt;But there is no match() method. &lt;/p&gt;
&lt;p&gt;Basically I'd like to simply tell DynaMock that I don't &lt;br /&gt;
care about this close() method. ATM, I've tricked it, by &lt;br /&gt;
using:&lt;/p&gt;
&lt;p&gt;mockQueueConnection.matchAndReturn(&amp;amp;quot;close&amp;amp;quot;, &lt;br /&gt;
null);&lt;/p&gt;
&lt;p&gt;But that seems like a hack (or even a DynaMock bug) &lt;br /&gt;
to me.&lt;/p&gt;
&lt;p&gt;Thanks&lt;br /&gt;
-Vincent&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Make Dynamic Objects work with any class</title><link href="https://sourceforge.net/p/mockobjects/feature-requests/2/" rel="alternate"/><published>2003-05-08T17:05:31Z</published><updated>2003-05-08T17:05:31Z</updated><author><name>Chris Nokleberg</name><uri>https://sourceforge.net/u/herbyderby/</uri></author><id>https://sourceforge.netcc2b0cdf0c94b0867626222554e88ad312b2eb43</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I didn't really want to subscribe to the dev list, and&lt;br /&gt;
you don't have any forums, so I hope you find my&lt;br /&gt;
message this way :-)&lt;/p&gt;
&lt;p&gt;I'm a developer with cglib.sf.net. It uses bcel to&lt;br /&gt;
dynamically create classes at runtime, for a variety of&lt;br /&gt;
use cases. If you switched your dynamic Mock class to&lt;br /&gt;
use cglib instead of java.lang.reflect.Proxy, you could:&lt;/p&gt;
&lt;p&gt;- be compatible with JDK 1.2&lt;br /&gt;
- mock almost any class (must have a non-private&lt;br /&gt;
constructor, and private or final methods cannot be mocked)&lt;br /&gt;
- perhaps realize a speed increase (creation of&lt;br /&gt;
object is slower, but method invocations are faster)&lt;/p&gt;
&lt;p&gt;I'll probably be using mock objects more soon, so I&lt;br /&gt;
might do this anyway, but if you are interested let me&lt;br /&gt;
know, I can point you in the right direction.&lt;/p&gt;
&lt;p&gt;chris at sixlegs dot com&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>MockHttpSession and MockHttpServletRequest </title><link href="https://sourceforge.net/p/mockobjects/feature-requests/1/" rel="alternate"/><published>2003-01-16T02:17:32Z</published><updated>2003-01-16T02:17:32Z</updated><author><name>Mingfai</name><uri>https://sourceforge.net/u/mingfai/</uri></author><id>https://sourceforge.net1f2a2396a9e41a186a92267cde7d63c160ef6e4e</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;The MockHttpSession and MockHttpServletRequest &lt;br /&gt;
consists of many unimplemented method that throw &lt;br /&gt;
exception. This is make them not too useful. I would like &lt;br /&gt;
to request for:&lt;/p&gt;
&lt;p&gt;1. make them as abstract and make the unimplemented &lt;br /&gt;
methods as abstract methods, so I can extend the &lt;br /&gt;
class conveniently. (instead of checking for the list of &lt;br /&gt;
unimplemented methods in the source one by one), or&lt;/p&gt;
&lt;p&gt;2. best of all, implement them!&lt;/p&gt;
&lt;p&gt;regards,&lt;br /&gt;
mingfai&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>