Assertions: assertSame() and assertNotSame()
Understand assertSame() and assertNotSame() methods in JUnit 5.
We'll cover the following...
The assertSame()
method
The assertSame()
method asserts that two Object
variables refer to the same Object
.
It has three overloaded methods.
- If the
actual
andexpected
values refer to the sameObject
, the test case passes. - If the
actual
andexpected
values don’t refer to the sameObject
, the test case fails.
Access this course and 1400+ top-rated courses and projects.