I have a singleton class with private constructor and want to write unit tests for that.
Any idea how to mock a class which has private constructor using mockito framework.
Thanks
I have a singleton class with private constructor and want to write unit tests for that.
Any idea how to mock a class which has private constructor using mockito framework.
Thanks
Whilst not answering your question directly, I think it would be worth reading about the singleton anti-pattern, and perhaps consider an alternative approach such as dependency injection with which to compose your application.
Well you should be able to use this library: http://code.google.com/p/powermock/ to do it. But it is highly discouraged.