AssertJFloatRules

SUGGESTION

Simplification

View source code on GitHub

Suppression

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

Table of contents
  1. AbstractFloatAssertIsCloseTo
  2. AbstractFloatAssertIsEqualTo
  3. AbstractFloatAssertIsNotEqualTo
  4. AbstractFloatAssertIsEqualToZero
  5. AbstractFloatAssertIsNotEqualToZero
  6. AbstractFloatAssertIsEqualToOne

AbstractFloatAssertIsCloseTo

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<AbstractFloatAssert<?>> testAbstractFloatAssertIsCloseTo() {
   return ImmutableSet.of(
-      assertThat(1f).isEqualTo(2, offset(0f)),
-      assertThat(1f).isEqualTo(Float.valueOf(2), offset(0f)));
+      assertThat(1f).isCloseTo(2, offset(0f)),
+      assertThat(1f).isCloseTo(Float.valueOf(2), offset(0f)));
 }

AbstractFloatAssertIsEqualTo

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<AbstractFloatAssert<?>> testAbstractFloatAssertIsEqualTo() {
-  return ImmutableSet.of(
-      assertThat(1f).isCloseTo(2, offset(0f)), assertThat(1f).isCloseTo(2, withPercentage(0)));
+  return ImmutableSet.of(assertThat(1f).isEqualTo(2), assertThat(1f).isEqualTo(2));
 }

AbstractFloatAssertIsNotEqualTo

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<AbstractFloatAssert<?>> testAbstractFloatAssertIsNotEqualTo() {
-  return ImmutableSet.of(
-      assertThat(1f).isNotCloseTo(2, offset(0f)),
-      assertThat(1f).isNotCloseTo(2, withPercentage(0)));
+  return ImmutableSet.of(assertThat(1f).isNotEqualTo(2), assertThat(1f).isNotEqualTo(2));
 }

AbstractFloatAssertIsEqualToZero

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 AbstractFloatAssert<?> testAbstractFloatAssertIsEqualToZero() {
-  return assertThat(1f).isZero();
+  return assertThat(1f).isEqualTo(0);
 }

AbstractFloatAssertIsNotEqualToZero

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 AbstractFloatAssert<?> testAbstractFloatAssertIsNotEqualToZero() {
-  return assertThat(1f).isNotZero();
+  return assertThat(1f).isNotEqualTo(0);
 }

AbstractFloatAssertIsEqualToOne

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 AbstractFloatAssert<?> testAbstractFloatAssertIsEqualToOne() {
-  return assertThat(1f).isOne();
+  return assertThat(1f).isEqualTo(1);
 }

Copyright © 2017-2026 Picnic Technologies BV