atom feed5 messages in org.codehaus.jmock.userMocking a method that expects a gener...
FromSent OnAttachments
Richard MartinNov 22, 2007 3:51 am 
Steve FreemanNov 22, 2007 6:34 am 
Dale KingNov 22, 2007 9:15 am 
Nat PryceNov 22, 2007 1:29 pm 
Dale KingNov 22, 2007 3:29 pm 
Subject:Mocking a method that expects a generic collection
From:Richard Martin (
Date:Nov 22, 2007 3:51:06 am


I seem to be really struggling trying to mock this method call, its an update call that takes an int as the key and a list of value objects to be updates. I just want the mock to accept the call of move on but I just can't seem to get it to work, at the moment I dont care whats in the list that is sent to the method.

The method signature is public void update(int key, List<ValueObjectVo> updates)

and my expectations is something like

final Dao dao = context.mock(Dao.class);

this.context.checking(new Expectations() { { allowing(dao).update(1, (List<CampaignChannelMapVo>)with(is( List.class))); } });

That doesn't work due to "not all parameters were given explicit constraints: either all parameters must be specified by explicit constraints or all must be specified by literal values to match"

I've tried lots of different things now and I think im just being stupid as I can't find any real reference to this in the mailing list so it must be possible.

Any one point me in the right direction?

Cheers Bob