Let's go through the following steps to understand assertEquals:
- In the following code, if you run the given assertEquals, it will not pass:
assertEquals(MyObj("abc"),MyObj("abc"))
- If you check the difference, it will tell you that they aren't equal because they are two different objects:
- So we will need to override the equals method of the MyObj class, and we will check the following things:
- Whether the other object references the same object—this can be done using the === operator, which checks the referential equality
- Whether the object in question equals the other object's Java class
- Whether the content of both objects ...