funbee / mockito

Automatically exported from code.google.com/p/mockito
0 stars 0 forks source link

Arguments are saved by a reference #18

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

See the attachment.

What is the expected output? What do you see instead?

Test should pass, while it fails.

Please use labels and text to provide additional information.

Didn't look at the source code, but it looks like Mockito saves arguments
by a reference. The problem is when argument's attribute is changed after
method invocation, so "equals" doesn't work as expected. Just look at the
attachment, it is pretty much self-explaining.

Original issue reported on code.google.com by bbankow...@gmail.com on 7 Aug 2008 at 4:14

Attachments:

GoogleCodeExporter commented 9 years ago
looking at it...

Original comment by szcze...@gmail.com on 7 Aug 2008 at 6:44

GoogleCodeExporter commented 9 years ago
Do you know a safe way of cloning any kind of objects? Not every class is 
Cloneable.
Not every object clones deeply :(

I set this one as WontFix because I don't see a way of "fixing" it, OK?

Original comment by szcze...@gmail.com on 7 Aug 2008 at 6:58

GoogleCodeExporter commented 9 years ago
So it is a drawback of Mockito when you compare it with tools using 
record/playback
model.

Original comment by bbankow...@gmail.com on 7 Aug 2008 at 8:06

GoogleCodeExporter commented 9 years ago

Original comment by szcze...@gmail.com on 19 Apr 2009 at 7:40