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
?
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
?
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.
eq((String) null)
will work for a String param which is null
.