Using Spock to mock private static final variables in Java
问题 I'm trying to write some Spock tests with Groovy to test some Java code (specifically a servlet Filter). I have some private static and private static final variables that I would like to mock, but I can't determine if there is a way to do this. I know metaClass is available for methods, is there anything similar for variables? For instance, I have: public class MyFilter implements Filter { private static WebResource RESOURCE; private static final String CACHE_KEY = "key-to-be-used-for-cache"