David Wallace
unread,Mar 11, 2012, 8:29:38 PM3/11/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to mockito
Can anybody suggest a good way of making an ArgumentCaptor for a
varargs argument? For example, if I make a mock myMock of a class
that has a method
process( Foo... foos )
I'd like to be able to write something like this.
ArgumentCaptor<Foo[].class> captor =
ArgumentCaptor.forClass( Foo[].class );
verify( myMock ).process( captor.capture());
and have this successfully verify a call like myMock.process( foo1,
foo2, foo3 );
The above doesn't work, because Mockito doesn't see process( foo1,
foo2, foo3 ) as a match for process( some array of Foo ).
Does anybody know a good workaround to this? If not, I shall probably
request this as a new feature.