Groovy Singleton and testing issue (with Spock)
问题 There's a discusson here about testing and singletons... but that is about Java patterns. My question is specifically about the Groovy @Singleton (annotation) way of implementing this pattern. This seems like another bit of Groovy Goodness. But I have a bit of a problem when testing (with Spock) using a class which has this annotation. If any of the state of this instance changes during a test (from the pristine, just-constructed state), as far as my experiments indicate this will then carry