|
|
|
[
Permlink
| « Hide
]
Mariusz Smyku?a - 06/Nov/09 07:35 AM
Sample project illustrating problem with observated method
There was a problem with the chaining mechanism
The problem occurs when an assert is performed on a method has a return value: For example: public List<String> list(int value); sampleService.assertInvoked().list(100); sampleService.assertInvoked().list(100); the second assertion will give the syntax error. The reason for this is that unitils automatically creates a mock list instance and replaces the assertion with: sampleService.assertInvoked().list(100).assertInvoked(); This makes it possible to do something like (i.e. method chaining): sampleService.assertInvoked().list(100).iterator(); I've fixed the issue so that this no longer causes a syntax error. Thanks for the report, I'll release a new version with the fix as soon as possible. Grtz, Tim I think better is to close bug when new version is released. Now new users can be confused when are searching for open and new bugs...
As a workaround we can ommit this bug actually with resetBehavior(); Example: sampleService.assertInvoked().list(100); sampleService.resetBehavior(); sampleService.assertInvoked().list(100); |
||||||||||||||||||||||||||||||||||||||||||||||||||||