How to mock a static variable in java using JMock
问题 I have a Unit testing problem where a class has a static variable which wants to load the Spring Application Ctx. This class DOES NOT come out of the Bean Factory and I cannot change this fact. static ApplicationContext applicationContext = ...; This works fine, but is hard to JMock , or atleast I don't know a way and until I can the Spring Ctx wants to start up. Not ideal for a unit test situation. Is there a work around that anyone knows? I have the option to change the static variable to