I'm currently writing the
Unit test for a class which instances are accessible only via a factory.
The Factory uses an array to return only one -specific- instances of the class. This is a sort of Singelton
Of course the factory is a static get<Method>.
The method uses a Collection to store existing reference & is, up to now, appropriatelly synchronized to avoid returning double instances even when accessed by multiple threads.
My question is (finally):
To make sure the system behaves OK, I'd like to be able to deregister the class. Something doing the opposite of
<code>
Class.forName("MyClassName");
</code>
This would allow me to run the test multiple times w/o having to ensure the class is always called with different parameters from one test to another.
Tx,
Thomas,
------------------