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. AbstractDoubleAssertIsCloseTo
  2. AbstractDoubleAssertIsEqualTo
  3. AbstractDoubleAssertIsNotEqualTo
  4. AbstractDoubleAssertIsEqualToZero
  5. AbstractDoubleAssertIsNotEqualToZero
  6. AbstractDoubleAssertIsEqualToOne

AbstractDoubleAssertIsCloseTo

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<AbstractDoubleAssert<?>> testAbstractDoubleAssertIsCloseTo() {
   return ImmutableSet.of(
-      assertThat(1.0).isEqualTo(2, offset(0.0)),
-      assertThat(1.0).isEqualTo(Double.valueOf(2), offset(0.0)));
+      assertThat(1.0).isCloseTo(2, offset(0.0)),
+      assertThat(1.0).isCloseTo(Double.valueOf(2), 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(1.0).isCloseTo(2, offset(0.0)), assertThat(1.0).isCloseTo(2, withPercentage(0)));
+  return ImmutableSet.of(assertThat(1.0).isEqualTo(2), assertThat(1.0).isEqualTo(2));
 }

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(1.0).isNotCloseTo(2, offset(0.0)),
-      assertThat(1.0).isNotCloseTo(2, withPercentage(0)));
+  return ImmutableSet.of(assertThat(1.0).isNotEqualTo(2), assertThat(1.0).isNotEqualTo(2));
 }

AbstractDoubleAssertIsEqualToZero

SUGGESTION

Simplification

Suppression

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

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

Samples

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

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

AbstractDoubleAssertIsNotEqualToZero

SUGGESTION

Simplification

Suppression

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

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

Samples

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

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

AbstractDoubleAssertIsEqualToOne

SUGGESTION

Simplification

Suppression

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

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

Samples

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

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

Copyright © 2017-2026 Picnic Technologies BV