Introduction
We use assertSame and assertNotSame to check if two things are exactly the same object or not. This helps us make sure our program uses the right objects.
When you want to check if two variables point to the exact same object in memory.
When you want to confirm that two objects are not the same instance, even if they look similar.
When testing if a method returns the same object it was given or a new one.
When you want to avoid accidental duplication of objects in your code.
When verifying singleton patterns where only one instance should exist.