@Inherited @Retention(value=RUNTIME) @Target(value=METHOD) public @interface Mock
Invocation; if this extra parameter is present, the remaining ones must match the
parameters in the real method.
The mock method must also have the same return type as the matching real method.
Method modifiers (public, final, static, etc.) between mock and mocked
methods don't have to be the same.
It's perfectly fine to have a non-static mock method for a static mocked method (or vice-versa),
for example.
Checked exceptions in the throws clause (if any) can also differ between the two matching methods.
A mock method can also target a constructor, in which case the previous considerations still apply,
except for the name of the mock method which must be "$init".
Another special mock method, "void $clinit()", will target the static
initializers of the faked class, if present in the mock-up class.
Yet another special mock method is "Object $advice(Invocation)", which if defined will
match every method in the target class hierarchy.Copyright © 2006–2016. All rights reserved.