Used inside a fake
class to indicate a fake method
whose implementation will temporarily
replace the implementation of a matching "real" method.
The fake method must have the same name and the same parameters as the matching real method, except for an optional
first parameter of type
; if this extra parameter is present, the remaining ones must match the
parameters in the real method.
The fake method must also have the same return type as the matching real method.
Method modifiers (
, etc.) between fake and faked methods
have to be the same.
It's perfectly fine to have a non-
fake method for a static
faked method (or vice-versa),
Checked exceptions in the throws
clause (if any) can also differ between the two matching methods.
A fake method
can also target a constructor
, in which case the previous considerations still apply,
except for the name of the fake method which must be "
Another special fake method, "
", will target the static
initializers of the faked class, if present in the fake class.
Yet another special fake method is "
", which if defined will
method in the target class hierarchy.