How to mock an enum singleton class using Mockito/Powermock?
If you want to stub out what INSTANCE returns, you can do it but it’s kind of nasty (using reflection & bytecode manipulation). I created & tested a simple project with three classes using the PowerMock 1.4.12 / Mockito 1.9.0. All classes were in the same package. SingletonObject.java public enum SingletonObject { INSTANCE; private int … Read more