While running the testng tests of the collaborator sample, it will fail
occasionally with exceptions like:
junit.framework.AssertionFailedError: Expectation not matched on verify:
'finalize()' on 'Mock for Collaborator (1)': expected 1, actual 0
'finalize()' on 'Mock for Collaborator (4)': expected 1, actual 0
'finalize()' on 'Mock for Collaborator (3)': expected 1, actual 0
'finalize()' on 'Mock for Collaborator (2)': expected 1, actual 0
'documentAdded("Document")' on 'Mock for Collaborator (6)': expected 1,
actual 1
'voteForRemoval("Document")' on 'Mock for Collaborator (6)': expected 1,
actual 1
It is because testng doesn't create new instances of the test classes
between tests.
The easiest way to solve this problem is to ignore the "finalize()" method.
Original issue reported on code.google.com by JohnnyJianHY on 28 May 2009 at 5:12
Original issue reported on code.google.com by
JohnnyJianHY
on 28 May 2009 at 5:12