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

AssertJLongRules

SUGGESTION

Simplification

View source code on GitHub

Suppression

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

Table of contents
  1. AbstractLongAssertIsEqualTo
  2. AbstractLongAssertIsNotEqualTo
  3. AbstractLongAssertIsZero
  4. AbstractLongAssertIsNotZero
  5. AbstractLongAssertIsOne

AbstractLongAssertIsEqualTo

SUGGESTION

Simplification

Suppression

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

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

Samples

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

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

AbstractLongAssertIsNotEqualTo

SUGGESTION

Simplification

Suppression

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

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

Samples

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

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

AbstractLongAssertIsZero

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 AbstractLongAssert<?> testAbstractLongAssertIsZero() {
-    return assertThat(0L).isZero();
+    return assertThat(0L).isEqualTo(0);
   }

AbstractLongAssertIsNotZero

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 AbstractLongAssert<?> testAbstractLongAssertIsNotZero() {
-    return assertThat(0L).isNotZero();
+    return assertThat(0L).isNotEqualTo(0);
   }

AbstractLongAssertIsOne

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 AbstractLongAssert<?> testAbstractLongAssertIsOne() {
-    return assertThat(0L).isOne();
+    return assertThat(0L).isEqualTo(1);
   }

Copyright © 2017-2023 Picnic Technologies BV