cbeust/testng — Issue #121: assertEquals(Object obj, Object obj) does not work correctly
Author: yaroslavherasym
Created: 2011-10-31 22:33:21+00:00
State: open

Im using the following statement that fails:
Assert.assertEquals(PersonCreated, personIdentityTypeCreated.getPerson(), "Persons Objects are not equal");

but their gson() output has been passed the following assertion:

Assert.assertEquals(gson.toJson(PersonCreated), gson.toJson(personIdentityTypeCreated.getPerson()), "Gson Persons Objects are not equal");

the output in testng-result.xml says:

Persons Objects are not equal expected: but was:

My understanding that the statement is comparing their object ids rather than their content.

ER(Expected Result): assert(Object objA, Object objB) compare their content.