AssertJComparableRules

SUGGESTION

Simplification

View source code on GitHub

Suppression

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

Table of contents
  1. AssertThatIsEqualByComparingTo
  2. AssertThatIsNotEqualByComparingTo
  3. AssertThatIsLessThan
  4. AssertThatIsLessThanOrEqualTo
  5. AssertThatIsGreaterThan
  6. AssertThatIsGreaterThanOrEqualTo

AssertThatIsEqualByComparingTo

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 AbstractComparableAssert<?, ?> testAssertThatIsEqualByComparingTo() {
-    return assertThat(BigDecimal.ZERO.compareTo(BigDecimal.ONE)).isEqualTo(0);
+    return assertThat(BigDecimal.ZERO).isEqualByComparingTo(BigDecimal.ONE);
   }

AssertThatIsNotEqualByComparingTo

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 AbstractComparableAssert<?, ?> testAssertThatIsNotEqualByComparingTo() {
-    return assertThat(BigDecimal.ZERO.compareTo(BigDecimal.ONE)).isNotEqualTo(0);
+    return assertThat(BigDecimal.ZERO).isNotEqualByComparingTo(BigDecimal.ONE);
   }

AssertThatIsLessThan

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 AbstractComparableAssert<?, ?> testAssertThatIsLessThan() {
-    return assertThat(BigDecimal.ZERO.compareTo(BigDecimal.ONE)).isNegative();
+    return assertThat(BigDecimal.ZERO).isLessThan(BigDecimal.ONE);
   }

AssertThatIsLessThanOrEqualTo

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 AbstractComparableAssert<?, ?> testAssertThatIsLessThanOrEqualTo() {
-    return assertThat(BigDecimal.ZERO.compareTo(BigDecimal.ONE)).isNotPositive();
+    return assertThat(BigDecimal.ZERO).isLessThanOrEqualTo(BigDecimal.ONE);
   }

AssertThatIsGreaterThan

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 AbstractComparableAssert<?, ?> testAssertThatIsGreaterThan() {
-    return assertThat(BigDecimal.ZERO.compareTo(BigDecimal.ONE)).isPositive();
+    return assertThat(BigDecimal.ZERO).isGreaterThan(BigDecimal.ONE);
   }

AssertThatIsGreaterThanOrEqualTo

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 AbstractComparableAssert<?, ?> testAssertThatIsGreaterThanOrEqualTo() {
-    return assertThat(BigDecimal.ZERO.compareTo(BigDecimal.ONE)).isNotNegative();
+    return assertThat(BigDecimal.ZERO).isGreaterThanOrEqualTo(BigDecimal.ONE);
   }

Copyright © 2017-2024 Picnic Technologies BV