keeganwitt / gmock

Automatically exported from code.google.com/p/gmock
6 stars 2 forks source link

Do not mock the finalize() method #85

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago

Original comment by julien.g...@gmail.com on 28 May 2009 at 6:23

GoogleCodeExporter commented 9 years ago

Original comment by JohnnyJianHY on 28 May 2009 at 7:05