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

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. AbstractFloatAssertIsCloseToWithOffset
  2. AbstractFloatAssertIsEqualTo
  3. AbstractFloatAssertIsNotEqualTo
  4. AbstractFloatAssertIsZero
  5. AbstractFloatAssertIsNotZero
  6. AbstractFloatAssertIsOne

AbstractFloatAssertIsCloseToWithOffset

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<AbstractFloatAssert<?>> testAbstractFloatAssertIsCloseToWithOffset() {
     return ImmutableSet.of(
-        assertThat(0F).isEqualTo(1, offset(0F)),
-        assertThat(0F).isEqualTo(Float.valueOf(1), offset(0F)));
+        assertThat(0F).isCloseTo(1, offset(0F)),
+        assertThat(0F).isCloseTo(Float.valueOf(1), 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(0F).isCloseTo(1, offset(0F)), assertThat(0F).isCloseTo(1, withPercentage(0)));
+    return ImmutableSet.of(assertThat(0F).isEqualTo(1), assertThat(0F).isEqualTo(1));
   }

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

AbstractFloatAssertIsZero

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 AbstractFloatAssert<?> testAbstractFloatAssertIsZero() {
-    return assertThat(0F).isZero();
+    return assertThat(0F).isEqualTo(0);
   }

AbstractFloatAssertIsNotZero

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 AbstractFloatAssert<?> testAbstractFloatAssertIsNotZero() {
-    return assertThat(0F).isNotZero();
+    return assertThat(0F).isNotEqualTo(0);
   }

AbstractFloatAssertIsOne

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 AbstractFloatAssert<?> testAbstractFloatAssertIsOne() {
-    return assertThat(0F).isOne();
+    return assertThat(0F).isEqualTo(1);
   }

Copyright © 2017-2023 Picnic Technologies BV