#30 Assertion in finally block hides the real failure

EasyMock_2.5
open
EasyMock (33)
3
2012-10-05
2009-10-12
No

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();

Discussion


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks