From: Barry K. <bk...@in...> - 2003-05-15 16:25:02
|
Tim Mackinnon wrote: > Actually if its just for getters and you just want to specify a return value > (and not bother setting an expectation, just use matchAndReturn). Or use > both to get an initial expectation and then a default (and then no need for > a special factory) > > expectAndReturn("getX", 5); > matchAndReturn("getX", 5); Ah! This is probably what I want. Thanks. Part of my problem is that I have not been using Mock.class until just recently. I have been using the subclasses of Call and integrating them with our existing simple mocks. Let me ask another question: The other reason I hacked CallSet was to support mutliple calls but in any order. Is that that the default behavior for Mock.class? |
From: Barry K. <bk...@in...> - 2003-05-15 21:59:35
|
Tim Mackinnon wrote: > Actually if its just for getters and you just want to specify a return value > (and not bother setting an expectation, just use matchAndReturn). Or use > both to get an initial expectation and then a default (and then no need for > a special factory) > > expectAndReturn("getX", 5); > matchAndReturn("getX", 5); Now I'm confused. I see no method matchAndReturn(). Is that only in the branch? |
From: Barry K. <bk...@in...> - 2003-05-16 14:23:33
|
> The branch is very stable - and we will be moving to it asap. I think it > addresses many of your issues. Great. Does a summary of the changes exist anywhere? |
From: Tim M. <tim...@po...> - 2003-05-19 23:20:10
|
Barry - I have quickly cut and pasted an early message I sent to Vincent that has the basics and put it on the wiki (http://www.mockobjects.com/wiki/UpgradingToDynaMock) - it should be reasonably clear. Maybe as you go through it you can update the mistakes or bits that I have missed. Tim > -----Original Message----- > From: moc...@li... > [mailto:moc...@li...]On Behalf Of > Barry Kaplan > Sent: 16 May 2003 15:24 > To: mockobjects > Subject: Re: [MO-java-dev] dynamic.CallBag which allows any number of > calls > > > > > The branch is very stable - and we will be moving to it asap. I think it > > addresses many of your issues. > > Great. Does a summary of the changes exist anywhere? > > > > ------------------------------------------------------- > Enterprise Linux Forum Conference & Expo, June 4-6, 2003, Santa Clara > The only event dedicated to issues related to Linux enterprise solutions > www.enterpriselinuxforum.com > > _______________________________________________ > Mockobjects-java-dev mailing list > Moc...@li... > https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev > > --- > Incoming mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.476 / Virus Database: 273 - Release Date: 24/04/2003 > --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.481 / Virus Database: 277 - Release Date: 13/05/2003 |
From: Barry K. <bk...@in...> - 2003-05-20 12:57:54
|
Just a first observation on the 0.9 changes. It now appears that a mock must be order or not across all methods. I tend to setup my mocks to be ordered or not on an individual method basis. I only order methods when the semantics explicitly require it. But when a mock method(s) needs to be ordered and counted, most other methods can be of the match*() type (ie, any number of calls in any order). Is such a setup still possible now that a mock cannot be given a Call? I like the idea of not requiring the use of CallSequence, but not the prevention of its use when necessary. Again, I'll covert over to 0.9 and get some concrete experience and report back and update the twiki. -bk |
From: <st...@m3...> - 2003-05-20 14:55:16
|
Our intention is that for some sort of call object there should be somethin= g like methodOne.exepectBefore(methodTwo) assertion. Our view was that most= of the time people would either care a lot or not at all about ordering, a= nd that we'd add this mechanism for special cases like yours. S. > Just a first observation on the 0.9 changes. It now appears that a mock= =20 > must be order or not across all methods. I tend to setup my mocks to be= =20 > ordered or not on an individual method basis. I only order methods when= =20 > the semantics explicitly require it. But when a mock method(s) needs to= =20 > be ordered and counted, most other methods can be of the match*() type=20 > (ie, any number of calls in any order). >=20 > Is such a setup still possible now that a mock cannot be given a Call? >=20 > I like the idea of not requiring the use of CallSequence, but not the=20 > prevention of its use when necessary. >=20 > Again, I'll covert over to 0.9 and get some concrete experience and=20 > report back and update the twiki. |
From: Barry K. <bk...@in...> - 2003-05-20 16:33:50
|
st...@m3... wrote: > Our intention is that for some sort of call object there should be something like methodOne.exepectBefore(methodTwo) assertion. Our view was that most of the time people would either care a lot or not at all about ordering, and that we'd add this mechanism for special cases like yours. Actually, ordering is not the biggest issue, but rather count. For example a strategy/flyweight that adjust a traders buyingpower might use any number of getters zero or more times, but should only adjust the actual buyingpower amount once (since in our case it will send an event which will trigger other actions in the domain model). I don't see how to do this with 0.9 as the Mock is constructed with a single implementation of CallableAddable. Am I missing something? -bk |
From: Barry K. <bk...@in...> - 2003-05-20 17:37:07
|
Nat Pryce wrote: > There should be a CallOnce decorator that gets added to a call's chain of > decorators by the expect method or perhaps another syntactic sugar method > (expectOnce?). This might not have been implemented yet. Ok, I think I see. Mock.expect() does indeed decorate the call via callFactory.createCallExpectation(), which in turn creates a CallOnceExpectation. Where Mock.match() does /not/ perform this decoration. Thus I assume that match() will allow any number of calls. Cool. |
From: <ma...@bt...> - 2003-05-21 15:48:38
|
Glad that you got in there after a did a few renames - seeing you write the stuff below makes me happy that the new names are much clearer (I was finding it confusing too). You have certainly understood it. Tim > from: Barry Kaplan <bk...@in...> > date: Tue, 20 May 2003 18:35:34 > to: moc...@li... > cc: nat...@b1... > subject: Re: [MO-java-dev] dynamic.CallBag which allows any number of calls > > > > Nat Pryce wrote: > > There should be a CallOnce decorator that gets added to a call's chain of > > decorators by the expect method or perhaps another syntactic sugar method > > (expectOnce?). This might not have been implemented yet. > > Ok, I think I see. Mock.expect() does indeed decorate the call via > callFactory.createCallExpectation(), which in turn creates a > CallOnceExpectation. Where Mock.match() does /not/ perform this decoration. > > Thus I assume that match() will allow any number of calls. Cool. > > > > > ------------------------------------------------------- > This SF.net email is sponsored by: ObjectStore. > If flattening out C or Java code to make your application fit in a > relational database is painful, don't do it! Check out ObjectStore. > Now part of Progress Software. http://www.objectstore.net/sourceforge > _______________________________________________ > Mockobjects-java-dev mailing list > Moc...@li... > https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev > |
From: Barry K. <bk...@in...> - 2003-05-21 22:46:56
|
Tim Mackinnon wrote: > Barry - I sent you an earlier message on this list that documented how to do > this... did you lose it? Hmm. Maybe, I'll have to look. > Yes its not in the box, but its pretty trivial to do call count stuff...? > All mocks take a callfactory - its like a policy. Just override the policy > and create your own mock as per that email. >>I don't see how to do this with 0.9 as the Mock is constructed with a >>single implementation of CallableAddable. Am I missing something? My issue was with that a Mock takes only a /single/ callfactory. But maybe its a non-issue. Let me play some more. I'm deep into converting a bunch of tests, so I should learn much. thanks! |