
mockito - issue #484
areEqual does not try == operator for trivial equality case and sometimes has unneccessary exceptions
What steps will reproduce the problem? 1. Any class that throws an exception in its equals method. For example:
private final class BadEquals { @Override public boolean equals (Object oth) { throw new RuntimeException(); } } 2. Create an instance of that class. Object badequals=new BadEquals(); 3. Test for equality using org.mockito.internal.matchers.Equality.areEqual: areEqual(badequals,badequals)
What is the expected output? What do you see instead? I expect to see they are equal.
I suspect that the areEqual method is calling the equals method which is throwing an Exception. In this case, we can use the java equality operator to see that they are equal, bypassing the equals method and its exception.
What version of the product are you using? On what operating system?
Please provide any additional information below.
Comment #1
Posted on Apr 20, 2014 by Massive MonkeyPushed to master. Thanks a lot for the pull request!
Comment #2
Posted on Aug 16, 2014 by Massive Monkey(No comment was entered for this change.)
Comment #3
Posted on Aug 24, 2014 by Massive Monkey(No comment was entered for this change.)
Comment #4
Posted on Aug 24, 2014 by Massive Monkey(No comment was entered for this change.)
Status: Fixed
Labels:
Type-Defect
Priority-Medium
Milestone-Release1.10.0