how to send not null object to the method call in stubbing

3,282 views
Skip to first unread message

akiMock

unread,
Dec 14, 2011, 6:31:00 AM12/14/11
to mockito
Hi,

akiMock

unread,
Dec 14, 2011, 6:35:42 AM12/14/11
to mockito

On Dec 14, 4:31 pm, akiMock <akiindi...@gmail.com> wrote:
> Hi,


I missed to add the comments.

I have mocked service which is called in another service but i am not
getting the stubbed return on execution.
could any one help

Brice

unread,
Dec 14, 2011, 6:36:11 AM12/14/11
to moc...@googlegroups.com
Hi,

I don't really get your problem. Could you provide some code to explain it.

Cheers,

-- 
Brice

Le mercredi 14 décembre 2011 à 12:31, akiMock a écrit :

Hi,

--
You received this message because you are subscribed to the Google Groups "mockito" group.
To post to this group, send email to moc...@googlegroups.com.
To unsubscribe from this group, send email to mockito+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mockito?hl=en.

akiMock

unread,
Dec 14, 2011, 6:43:48 AM12/14/11
to mockito

On Dec 14, 4:36 pm, Brice <brice.duth...@gmail.com> wrote:
> Hi,
>
> I don't really get your problem. Could you provide some code to explain it.
>
> Cheers,
>
> --
> Brice
>
> Le mercredi 14 décembre 2011 à 12:31, akiMock a écrit :
>
> > Hi,

> Here is what i have

when(dynamicRecommendationsManager.getNextBestAction(customer,
otherService, borrowingInfo, address, bankingNeed, reply)).
thenReturn(nab).

the above service is being called in service class for which i have
written the test class. In the above method call, all the parameters
are returned from the different services. parameter otherService and
reply are list of OtherServices customer has and answers to the
question respectively.

when i execute the method i am getting null but i am expecting, it
should return nab object.

i tried calling real method but no use.

thanks,
aki

akiMock

unread,
Dec 14, 2011, 6:52:35 AM12/14/11
to mockito


hi Brice,
Any idea

akiMock

unread,
Dec 14, 2011, 7:35:39 AM12/14/11
to mockito


here what i thought is, if we pass not null parameter it may give the
expected return.
but i am not able to send the not null object like we do in jMockery
as with(aNonNull(String.class)).

is there any way in mockito by which we can pass the not null
parameter

Szczepan Faber

unread,
Dec 14, 2011, 2:05:24 PM12/14/11
to moc...@googlegroups.com
Hey,


There's a isNotNull() method you can use.

Cheers!

--
You received this message because you are subscribed to the Google Groups "mockito" group.
To post to this group, send email to moc...@googlegroups.com.
To unsubscribe from this group, send email to mockito+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mockito?hl=en.




--
Szczepan Faber
Principal engineer@gradleware
Lead@mockito
Reply all
Reply to author
Forward
0 new messages