Assertion in finally block hides the real failure
Brought to you by:
tammofreese
Submitted by virtualwarp
I have an issue when testing code that has a try-finally block.
When I run a test for code containing a try-finally block, easymock
reports the last unexpected call. If an expectation in the try-block fails,
the expectation in the finally-block will also fail. Since the last failure
is reported, the original reason for the failure is no longer visible.
Example:
mock.write(2);
mock.close();
replay();
try {
mock.write(1);
} finally {
mock.close();
}
verify();