The JUnit assertEquals(obj1, obj2)
does indeed call obj1.equals(obj2)
.
There's also assertSame(obj1, obj2)
which does obj1 == obj2
(i.e., verifies that obj1
and obj2
are referencing the same instance), which is what you're trying to avoid.
So you're fine.