AssertJBigDecimalRules

SUGGESTION

Simplification

View source code on GitHub

Suppression

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

Table of contents
  1. AbstractBigDecimalAssertIsEqualByComparingTo
  2. AbstractBigDecimalAssertIsNotEqualByComparingTo

AbstractBigDecimalAssertIsEqualByComparingTo

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<AbstractBigDecimalAssert<?>> testAbstractBigDecimalAssertIsEqualByComparingTo() {
     return ImmutableSet.of(
-        assertThat(BigDecimal.ZERO).isCloseTo(BigDecimal.ONE, offset(BigDecimal.ZERO)),
-        assertThat(BigDecimal.ZERO).isCloseTo(BigDecimal.ONE, withPercentage(0)));
+        assertThat(BigDecimal.ZERO).isEqualByComparingTo(BigDecimal.ONE),
+        assertThat(BigDecimal.ZERO).isEqualByComparingTo(BigDecimal.ONE));
   }

AbstractBigDecimalAssertIsNotEqualByComparingTo

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<AbstractBigDecimalAssert<?>> testAbstractBigDecimalAssertIsNotEqualByComparingTo() {
     return ImmutableSet.of(
-        assertThat(BigDecimal.ZERO).isNotCloseTo(BigDecimal.ONE, offset(BigDecimal.ZERO)),
-        assertThat(BigDecimal.ZERO).isNotCloseTo(BigDecimal.ONE, withPercentage(0)));
+        assertThat(BigDecimal.ZERO).isNotEqualByComparingTo(BigDecimal.ONE),
+        assertThat(BigDecimal.ZERO).isNotEqualByComparingTo(BigDecimal.ONE));
   }

Copyright © 2017-2024 Picnic Technologies BV