Assert.assertEquals() fails for custom class objects [closed]
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 5 years ago . Even though I have two data objects of a custom class which are equal w.r.t all the variables, assertEquals() method is failing. What am I missing here? 回答1: For comparing two objects you need to override the equals() method of the Object class. When you create two objects of a class, say class A ,