EasyMock

finalize() should be treated specially

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 2.4
  • Fix Version/s: 3.1
  • Component/s: Class Extension
  • Labels:
    None

Description

If I lose all references to a mock in a test, it may (or may not) get GCed before the test is over. If it does happen, this creates an expectation of a call to finalize(), making the test fail. Since the GC is unpredictable, this leads to flaky tests.
We should treat finalize() specially, probably by ignoring it completely, since it makes no sense to expect it given that there's no way to force GC.

Activity

Hide
Henri Tremblay added a comment - - edited

finalize calls are now ignored

Show
Henri Tremblay added a comment - - edited finalize calls are now ignored
Hide
Sean Flanigan added a comment -

That should be "finalize calls are now ignored", right? It looks that way from the SVN commit. http://easymock.svn.sourceforge.net/viewvc/easymock?view=revision&revision=223

Thanks for the fix.

Show
Sean Flanigan added a comment - That should be "finalize calls are now ignored", right? It looks that way from the SVN commit. http://easymock.svn.sourceforge.net/viewvc/easymock?view=revision&revision=223 Thanks for the fix.
Hide
Henri Tremblay added a comment - - edited

Absolutely. Fixed

Show
Henri Tremblay added a comment - - edited Absolutely. Fixed

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: