ssacher-tgm / mockito

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

Verified arguments can be mutated before they are verified. #185

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
The problem is that the verification happens after the method was invoked. 
If the argument is mutated then the test incorrectly fails.

For example verifying a mock is passed a list of three objects. After the 
mock is called in the tested code the list is cleared. Teh verification 
fails as the list is now empty even though at the time it called the mock 
it had 3 objects in it.

Original issue reported on code.google.com by benstopf...@gmail.com on 30 Apr 2010 at 5:04

GoogleCodeExporter commented 8 years ago
Tough luck here... It is not really fixable due to the nature of 'spying'. 
Unless you
have some great idea :)

Original comment by szcze...@gmail.com on 4 May 2010 at 12:59

GoogleCodeExporter commented 8 years ago

Original comment by szcze...@gmail.com on 24 May 2010 at 5:46