Alternate names: MockitoBadFinalMethod, CannotMockFinalMethod
Mockito cannot mock
static methods, and cannot tell at runtime that
this is attempted and fail with an error (as mocking
final classes does).
when(mock.finalMethod()) will invoke the real implementation of
In some cases, this may wind up accidentally doing what’s intended:
convert is final, but under the hood, calls
doForward, so we wind up mocking
that method instead.
Suppress false positives by adding the suppression annotation
@SuppressWarnings("CannotMockMethod") to the enclosing element.