You know you're a Java programmer if...

Article by Daniel Volkovich
The following is a real life question asked on a forum. WARNING: do not read too far into each word. To make it through this question, you must take each word with a grain of salt, a completely unrelated kernel of wisdom floating somewhere out in space, and having no real connection to anything tangible...


How to Mock a Static Singleton

I have number of classes I've been asked to add some unit tests to with Rhino Mocks and having some issues.

First off, I know RhinoMocks doesn't allow for the mocking of Static members. I'm looking for what options I have (besides using TypeMock).

Now, the only thing I have to say is if you can actually parse this question into english then either you are a) a rocket scientist b) crazy or c) a Java programmer.

On a side note, I do know a few creative ways to mock a static singleton, but I'm dying to hear your suggestions...
(Contributed by daniel on Friday, January 28th, 2011)
See All Articles