MockitoRules
SUGGESTION
Simplification
Suppression
Disable all rules by adding
-XepOpt:Refaster:NamePattern=^(?!MockitoRules\$).*as compiler argument.
Table of contents
Never
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("Never")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!MockitoRules\$Never).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
VerificationMode testNever() {
- return times(0);
+ return never();
}Verify
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("Verify")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!MockitoRules\$Verify).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Object testVerify() {
- return verify(mock(Object.class), times(1));
+ return verify(mock(Object.class));
}InvocationOnMockGetArgument
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("InvocationOnMockGetArgument")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!MockitoRules\$InvocationOnMockGetArgument).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Object testInvocationOnMockGetArgument() {
- return ((InvocationOnMock) null).getArguments()[0];
+ return ((InvocationOnMock) null).getArgument(0);
}InvocationOnMockGetArgumentObject
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("InvocationOnMockGetArgumentObject")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!MockitoRules\$InvocationOnMockGetArgumentObject).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<Number> testInvocationOnMockGetArgumentObject() {
return ImmutableSet.of(
- ((InvocationOnMock) null).getArgument(0, Integer.class),
- (Double) ((InvocationOnMock) null).getArgument(1));
+ ((InvocationOnMock) null).<Integer>getArgument(0),
+ ((InvocationOnMock) null).<Double>getArgument(1));
}