Focusing on the singleton nature, there are two essential behaviors and two optional behaviors we need to test. The two essential behaviors are
getInstance() returns an instance of the class
getInstance() returns the same instance for all invocations
Let’s address these and then talk about the optional behaviors. Note that we did not say anything about the initialized state of the instance. That is not part of the value added by the
getInstance() method. Rather, it is part of the value added by the class member initialization and the constructor, which are a separate bundle of intents.
The second behavior, that the singleton always returns the same instance, is the behavior that makes singletons difficult ...