NotAMockException message not clear enough

3,408 views
Skip to first unread message

Eugen Paraschiv

unread,
Oct 12, 2010, 6:45:45 AM10/12/10
to mockito
Quick question - can the message displayed by NotAMockException
include the class name of the object that is not a mock?
I just made a mistake with the syntax - I wrote:
Mockito.verify( mockInstance.method() );
instead of
Mockito.verify( mockInstance ).method();
Missplacing the parentheses meant that I was passing in a Boolean
instead of the mockInstance, but that wasn't clear from the exception
I got. I figured it out after a few minutes of debugging, but it would
have been so much easier if the exception message just said:
org.mockito.exceptions.misusing.NotAMockException:
Argument passed to verify() is of type java.lang.Boolean and is not a
mock!
instead of just
org.mockito.exceptions.misusing.NotAMockException:
Argument passed to verify() is not a mock!

Any thoughts on this? Should I raise it as a minor issue?
Thanks
Eugen.

szczepiq

unread,
Oct 12, 2010, 8:51:18 AM10/12/10
to moc...@googlegroups.com
I like it. Can you submit an issue (or I you are a real knight even include a fix & a test :D).

Mockito uses mercurial now (via googlecode) so you can clone it easily.

Cheers,
Szczepan


--
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.


Eugen Paraschiv

unread,
Oct 15, 2010, 7:57:43 AM10/15/10
to mockito
I'll submit an issue now and try to do that patch during the weekend.
Thanks.
Eugen.

On Oct 12, 3:51 pm, szczepiq <szcze...@gmail.com> wrote:
> I like it. Can you submit an issue (or I you are a real knight even include
> a fix & a test :D).
>
> Mockito uses mercurial now (via googlecode) so you can clone it easily.
>
> Cheers,
> Szczepan
>
> > mockito+u...@googlegroups.com<mockito%2Bunsu...@googlegroups.com>
> > .
Reply all
Reply to author
Forward
0 new messages