djcrankypants / spock

Automatically exported from code.google.com/p/spock
0 stars 0 forks source link

Don't use ObjenesisHelper #335

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
We have an issue in Grails (http://jira.grails.org/browse/GRAILS-10720) where a 
ClassCastException is thrown on second run of the tests. This is because Spock 
uses ObjenesisHelper which has the cache enabled by default. The Objenesis 
cache uses the class name as the key (not the class) this results if a 
different class being returned and the resulting ClassCastException.

Unfortunately because Spock uses ObjenesisHelper there is no way to disable the 
cache. Spock should use a customisable version of the ObjenesisStd and 
ObjenesisSerializer classes that can be modified by the user / other frameworks 
if needed

Original issue reported on code.google.com by graeme.r...@gmail.com on 12 Nov 2013 at 1:21