« Return to Thread: grabbing value from mutator on mockobject?

Re: grabbing value from mutator on mockobject?

by nino martinez wael :: Rate this Message:

Reply to Author | View in Thread

The reason that I asked this question anyhow was because I wanted to
use the real object but I cant grab it since Im not sure howto do that
with jmock..

For example here I expect this:

                                one(keySetupCpr).setTerminators(with(any(List.class)));

if I could grab that list things would be easier...

2009/6/11 nino martinez wael <nino.martinez.wael@...>:

> Hi Steve, replying inline...
>
> 2009/6/11 Steve Freeman <steve@...>:
>> Sorry, I need to clarify.
>>
>> The service returns a KeySetup?
> Yes..
>> And you give the KeySetup a list to fill in?
> Yes.
>
>> Then you call getTerminators to return a List?
> Some other part of what I am testing yes.
>>
>> What's in KeySetup? Would you be better off just using a real object?
> Only simple stuff, but yes I am wondering if I would be better off
> using the real object..
>>
>> Why do you set the list and then retrieve it?
> Again it's some of the underlying stuff that does that.
>>
>> S.
>>
>>
>> On 11 Jun 2009, at 13:26, nino martinez wael wrote:
>>>
>>> Hi
>>>
>>> I might be headed down a wrong path.. But I have something like this:
>>>
>>>                                KeySetup
>>> keySetupCpr=mockery.mock(KeySetup.class);
>>>
>>>  one(readOnlyAllInOneService).getKeySetup(KeySetupIdentification.class,
>>> "1010", "CustomCustomerIdent");
>>>                                will(returnValue(keySetupCpr));
>>>
>>>  one(keySetupCpr).setTerminators(with(any(List.class)));
>>>
>>> Now my keysetup are being called with a list and the next thing that
>>> happens are a call to get keySetup.getTerminators , are there any way
>>> I can get the list that has just been set and return that?
>>>
>>> regards Nino
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe from this list, please visit:
>>>
>>>   http://xircles.codehaus.org/manage_email
>>>
>>>
>>
>> Steve Freeman
>> Winner of the Agile Alliance Gordon Pask award 2006
>>
>> http://www.m3p.co.uk
>>
>> M3P Limited.
>> Registered office. 2 Church Street, Burnham, Bucks, SL1 7HZ.
>> Company registered in England & Wales. Number 03689627
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>   http://xircles.codehaus.org/manage_email
>>
>>
>>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


 « Return to Thread: grabbing value from mutator on mockobject?