Gennady
6/27/2005 6:37:00 PM
Joe Van Dyk wrote:
> Hi,
>
> How can I properly unit test a singleton? I want to reinitialize it
> on every test method, but since it seems to stick around in memory, I
> can't seem to ever create a new singleton object.
>
> Thanks,
> Joe
>
In extremely rear case when I need a singleton nowadays, I usually end
up with 2 classes: one is a "normal" class that can be tested and
anything and another that is the actual singleton to be used in the
application that delegates all missing methods to the first one or
simply inherits from it.
Gennady.