I do . Mockito uses the Hamcrest matchers. When you say which objects you expect to pass in as parameters, it calls equals() on the object ot determine if they are equivalent.
Before, you were using Object equals() implementation. Which checked if they were the same object. Since they weren't, Mockito didn't recognize them as being the same. Once you added the equals() implementation, Mockito saw them as the same and the tests behaved as you expected.
At 3 line I create new object of user. At 4 line I pass another object. They are not the same, right? How does it know that object from line that I pass and object from 4 line are the same... By this method?