Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JUnit test (assertEquals) -- what does it mean?

807598Dec 6 2005 — edited Sep 18 2008
I know that assertEquals compares an EXPECTED object to an ACTUAL object, but what does the following do:
ExampleClass ec = new ExampleClass();
assertEquals(ec,ec);
assertTrue(ec==ec);
... I can't quite get why one would do such a test (this is an example I've come across when reading up on unit testing which isn't explained). It doesn't make sense and I can't find anything about comparing the SAME object to itself on the net...?

Anyone got any thoughts on this?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 16 2008
Added on Dec 6 2005
9 comments
1,417 views