square / assertj-android

A set of AssertJ helpers geared toward testing Android.
https://square.github.io/assertj-android/
Apache License 2.0
1.58k stars 156 forks source link

asserts using isEqualToIgnoringGivenFields or isEqualToComparingFieldByField doesnt work properly #162

Closed otoniel-isidoro closed 9 years ago

otoniel-isidoro commented 9 years ago

I have the following objects:

actual:
UserInfo{userId='97ed99c1-13d9-4886-99f0-15e3e309bfac', appInstallId='f9d6abaf-e3e4-4281-9ad2-9d8083bd5936', scenarioId=18, advertisingId='803cef82-00af-4c0d-b76e-4f438118ec71', androidId='5ec1103ef436f4f6', imei='null', pushToken='null', platformAccountEmail='[]', deviceSystemName='ANDROID', deviceSystemVersion='5.1', deviceCountry='US', deviceLanguage='en', deviceTimezone='-3', deviceManufacturer='unknown', deviceModel='Android SDK built for x86', appInstalledAt=1432823697421, appVersion='0.11.3', appSdkVersion='0.11.4', tags=null}

expected: UserInfo{userId='97ed99c1-13d9-4886-99f0-15e3e309bfac', appInstallId='f9d6abaf-e3e4-4281-9ad2-9d8083bd5936', scenarioId=17, advertisingId='803cef82-00af-4c0d-b76e-4f438118ec71', androidId='5ec1103ef436f4f6', imei='null', pushToken='APA91bE_u2RlHz9HmiK68-RQfZcDTU_Wzsf7xZgYPp4orGmsrs5uXZ1tmE56TsPiqxfUtGuAxRTuayC0_vmeLiyATEJNaG8z_i6RdP9Oj-rD2zyJp6pFduBrvdO6gjJgAHLup5V5WVIFKzGIkZ3wyBG3WNvKc9Ecpg', platformAccountEmail='[]', deviceSystemName='ANDROID', deviceSystemVersion='5.1', deviceCountry='US', deviceLanguage='en', deviceTimezone='-3', deviceManufacturer='unknown', deviceModel='Android SDK built for x86', appInstalledAt=1432823697421, appVersion='0.11.3', appSdkVersion='0.11.4', tags=null}

When I use isEqualTo assertions the following failure is threw properly: org.junit.ComparisonFailure: expected:<...d5936', scenarioId=3[3, advertisingId='803cef82-00af-4c0d-b76e-4f438118ec71', androidId='5ec1103ef436f4f6', imei='null', pushToken='APA91bE_u2RlHz9HmiK68-RQfZcDTU_Wzsf7xZgYPp4orGmsrs5uXZ1tmE56TsPiqxfUtGuAxRTuayC0_vmeLiyATEJNaG8z_i6RdP9Oj-rD2zyJp6pFduBrvdO6gjJgAHLup5V5WVIFKzGIkZ3wyBG3WNvKc9Ecpg]', platformAccountEm...> but was:<...d5936', scenarioId=3[4, advertisingId='803cef82-00af-4c0d-b76e-4f438118ec71', androidId='5ec1103ef436f4f6', imei='null', pushToken='null]', platformAccountEm...>

But, when I use isEqualToComparingFieldByField or isEqualToIgnoringGivenFields the test pass even with different values on object's fields.

JakeWharton commented 9 years ago

Those features are from AssertJ not AssertJ-Android. Please file a bug on the AssertJ project.

On Fri, May 29, 2015, 11:24 AM Otoniel notifications@github.com wrote:

I have the following objects:

actual:

UserInfo{userId='97ed99c1-13d9-4886-99f0-15e3e309bfac', appInstallId='f9d6abaf-e3e4-4281-9ad2-9d8083bd5936', scenarioId=18, advertisingId='803cef82-00af-4c0d-b76e-4f438118ec71', androidId='5ec1103ef436f4f6', imei='null', pushToken='null', platformAccountEmail='[]', deviceSystemName='ANDROID', deviceSystemVersion='5.1', deviceCountry='US', deviceLanguage='en', deviceTimezone='-3', deviceManufacturer='unknown', deviceModel='Android SDK built for x86', appInstalledAt=1432823697421, appVersion='0.11.3', appSdkVersion='0.11.4', tags=null}

expected: UserInfo{userId='97ed99c1-13d9-4886-99f0-15e3e309bfac', appInstallId='f9d6abaf-e3e4-4281-9ad2-9d8083bd5936', scenarioId=17, advertisingId='803cef82-00af-4c0d-b76e-4f438118ec71', androidId='5ec1103ef436f4f6', imei='null', pushToken='APA91bE_u2RlHz9HmiK68-RQfZcDTU_Wzsf7xZgYPp4orGmsrs5uXZ1tmE56TsPiqxfUtGuAxRTuayC0_vmeLiyATEJNaG8z_i6RdP9Oj-rD2zyJp6pFduBrvdO6gjJgAHLup5V5WVIFKzGIkZ3wyBG3WNvKc9Ecpg', platformAccountEmail='[]', deviceSystemName='ANDROID', deviceSystemVersion='5.1', deviceCountry='US', deviceLanguage='en', deviceTimezone='-3', deviceManufacturer='unknown', deviceModel='Android SDK built for x86', appInstalledAt=1432823697421, appVersion='0.11.3', appSdkVersion='0.11.4', tags=null}

When I use isEqualTo assertions the following failure is threw properly: org.junit.ComparisonFailure: expected:<...d5936', scenarioId=3[3, advertisingId='803cef82-00af-4c0d-b76e-4f438118ec71', androidId='5ec1103ef436f4f6', imei='null', pushToken='APA91bE_u2RlHz9HmiK68-RQfZcDTU_Wzsf7xZgYPp4orGmsrs5uXZ1tmE56TsPiqxfUtGuAxRTuayC0_vmeLiyATEJNaG8z_i6RdP9Oj-rD2zyJp6pFduBrvdO6gjJgAHLup5V5WVIFKzGIkZ3wyBG3WNvKc9Ecpg]', platformAccountEm...> but was:<...d5936', scenarioId=3[4, advertisingId='803cef82-00af-4c0d-b76e-4f438118ec71', androidId='5ec1103ef436f4f6', imei='null', pushToken='null]', platformAccountEm...>

But, when I use isEqualToComparingFieldByField or isEqualToIgnoringGivenFields the test pass even with different values on fields of the objects.

— Reply to this email directly or view it on GitHub https://github.com/square/assertj-android/issues/162.

otoniel-isidoro commented 9 years ago

Ok thx!