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

AssertJIntegerRules

SUGGESTION

Simplification

View source code on GitHub

Suppression

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

Table of contents
  1. AbstractIntegerAssertIsEqualTo
  2. AbstractIntegerAssertIsNotEqualTo
  3. AbstractIntegerAssertIsZero
  4. AbstractIntegerAssertIsNotZero
  5. AbstractIntegerAssertIsOne

AbstractIntegerAssertIsEqualTo

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<AbstractIntegerAssert<?>> testAbstractIntegerAssertIsEqualTo() {
-    return ImmutableSet.of(
-        assertThat(0).isCloseTo(1, offset(0)), assertThat(0).isCloseTo(1, withPercentage(0)));
+    return ImmutableSet.of(assertThat(0).isEqualTo(1), assertThat(0).isEqualTo(1));
   }

AbstractIntegerAssertIsNotEqualTo

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<AbstractIntegerAssert<?>> testAbstractIntegerAssertIsNotEqualTo() {
-    return ImmutableSet.of(
-        assertThat(0).isNotCloseTo(1, offset(0)), assertThat(0).isNotCloseTo(1, withPercentage(0)));
+    return ImmutableSet.of(assertThat(0).isNotEqualTo(1), assertThat(0).isNotEqualTo(1));
   }

AbstractIntegerAssertIsZero

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 AbstractIntegerAssert<?> testAbstractIntegerAssertIsZero() {
-    return assertThat(0).isZero();
+    return assertThat(0).isEqualTo(0);
   }

AbstractIntegerAssertIsNotZero

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 AbstractIntegerAssert<?> testAbstractIntegerAssertIsNotZero() {
-    return assertThat(0).isNotZero();
+    return assertThat(0).isNotEqualTo(0);
   }

AbstractIntegerAssertIsOne

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 AbstractIntegerAssert<?> testAbstractIntegerAssertIsOne() {
-    return assertThat(0).isOne();
+    return assertThat(0).isEqualTo(1);
   }

Copyright © 2017-2023 Picnic Technologies BV