Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does EasyMock.anyObject() match a null parameter?

Tags:

java

easymock

My SUT may call a method on my mock with any object as paramter, including null.

So, does EasyMock.anyObject() match a null parameter? or can I use something else instead of anyObject() which will also match null ?

like image 404
Bjarke Freund-Hansen Avatar asked Dec 27 '22 12:12

Bjarke Freund-Hansen


1 Answers

Since EasyMock also offers matchers for notNull() and null(), I assume the answer is yes - otherwise anyObject() and notNull() would be redundant (if anyObject() did not match null).

A simple test confirms this.

like image 195
matt b Avatar answered Jan 11 '23 08:01

matt b