|
From: <lau...@ma...> - 2002-05-09 11:19:28
|
On 8 May, Steve Freeman wrote:
> Do you have an example?
>
Well, something like this:
Foo methodToTest() {
ObjectHome home = mockFactory.getHomeObject();
Object o = home.create()
return o.getFoo();
}
In order for this method to be tested correctly, o has to be avalid object.
I have two way of doing this: either Home.create() implements all the logic
to create a correct Foo object (and in our case, sometimes that's a
multi-step operation) or I add a setupFoo(Foo o) method that will
effectively do the same thing, but the multi-step operation occurs outside
of the mock object that is returned by getHomeObject().
I think what I need to understand is where do I stop reimplementing the
logic of my real application in the mock object?
L
--
Laurent Duperval <mailto:lau...@ma...>
There are two rules for success in life:
Rule 1: Don't tell people everything you know.
|