Closed GoogleCodeExporter closed 9 years ago
Tried changing the return type to Number and the mock returns null.
Tried Double and the mock returned 0.0.
Note: This is with no stubbing on the mock, just a plain new mock creation and
calling the methods on it.
Original comment by ssqos...@gmail.com
on 26 May 2009 at 5:41
Hi,
The compiler hides the difference between int and Integer and vice versa.
Therefore
we decided to make the framework consistent and have zeros returned by default
also
by Integer-returning methods. It was done in some very early version of
Mockito. I
didn't think about Number though - it probably should also return 0.
Mockito by default tries to return 'nice' values to be transparent and
unobtrusive.
Therefore zeros but not nulls because it is less likely you will hit NPE.
Original comment by szcze...@gmail.com
on 26 May 2009 at 9:27
Ok, that makes sense now. Although it is not what I (and my colleagues) would
expect.
I will pass this on.
Again, thanks for clearing this up
Original comment by ssqos...@gmail.com
on 26 May 2009 at 10:45
Ok cool.
I'll try to make it clearer in the FAQ or the documentation later.
Original comment by szcze...@gmail.com
on 27 May 2009 at 12:35
Original comment by szcze...@gmail.com
on 9 Jul 2009 at 12:48
Added info to the FAQ, closing this one.
Original comment by szcze...@gmail.com
on 22 Sep 2009 at 9:10
Original issue reported on code.google.com by
ssqos...@gmail.com
on 26 May 2009 at 5:36