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

AssertJDoubleRules

SUGGESTION

Simplification

View source code on GitHub

Suppression

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

Table of contents
  1. AbstractDoubleAssertIsCloseToWithOffset
  2. AbstractDoubleAssertIsEqualTo
  3. AbstractDoubleAssertIsNotEqualTo
  4. AbstractDoubleAssertIsZero
  5. AbstractDoubleAssertIsNotZero
  6. AbstractDoubleAssertIsOne

AbstractDoubleAssertIsCloseToWithOffset

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<AbstractDoubleAssert<?>> testAbstractDoubleAssertIsCloseToWithOffset() {
     return ImmutableSet.of(
-        assertThat(0.0).isEqualTo(1, offset(0.0)),
-        assertThat(0.0).isEqualTo(Double.valueOf(1), offset(0.0)));
+        assertThat(0.0).isCloseTo(1, offset(0.0)),
+        assertThat(0.0).isCloseTo(Double.valueOf(1), offset(0.0)));
   }

AbstractDoubleAssertIsEqualTo

SUGGESTION

Simplification

Suppression

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

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

Samples

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

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

AbstractDoubleAssertIsNotEqualTo

SUGGESTION

Simplification

Suppression

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

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

Samples

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

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

AbstractDoubleAssertIsZero

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 AbstractDoubleAssert<?> testAbstractDoubleAssertIsZero() {
-    return assertThat(0.0).isZero();
+    return assertThat(0.0).isEqualTo(0);
   }

AbstractDoubleAssertIsNotZero

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 AbstractDoubleAssert<?> testAbstractDoubleAssertIsNotZero() {
-    return assertThat(0.0).isNotZero();
+    return assertThat(0.0).isNotEqualTo(0);
   }

AbstractDoubleAssertIsOne

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 AbstractDoubleAssert<?> testAbstractDoubleAssertIsOne() {
-    return assertThat(0.0).isOne();
+    return assertThat(0.0).isEqualTo(1);
   }

Copyright © 2017-2023 Picnic Technologies BV