Skip to content

Commit

Permalink
Fix stackoverflow in ArgumentsAreDifferent reporting
Browse files Browse the repository at this point in the history
When using Mockito without opentest4j, reporting an
ArgumentsAreDifferent exception would throw a StackOverflowError when
attempting to obtain the message from the exception.

The root problem was that super.toString() would call its own
getMessage(). Instead, we should obtain the message from the super, to
avoid the circular call.
  • Loading branch information
TimvdLippe committed May 11, 2021
1 parent 067ff24 commit a53876d
Showing 1 changed file with 1 addition and 1 deletion.
Expand Up @@ -31,6 +31,6 @@ public ArgumentsAreDifferent(String message, String wanted, String actual) {

@Override
public String getMessage() {
return removeFirstLine(super.toString());
return removeFirstLine(super.getMessage());
}
}

0 comments on commit a53876d

Please sign in to comment.