Skip to main content Link Search Menu Expand Document (external link)

MockitoRules

SUGGESTION

Simplification

View source code on GitHub

Suppression

Disable all rules by adding -XepOpt:Refaster:NamePattern=^(?!(MockitoRules.*)) as compiler argument.

Table of contents
  1. Never
  2. VerifyOnce

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();
   }

VerifyOnce

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("VerifyOnce") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!(MockitoRules\.VerifyOnce)) as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 Object testVerifyOnce() {
-    return verify(mock(Object.class), times(1));
+    return verify(mock(Object.class));
   }

Copyright © 2017-2023 Picnic Technologies BV