AssertJShortRules

SUGGESTION

Simplification

View source code on GitHub

Suppression

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

Table of contents
  1. AbstractShortAssertIsEqualTo
  2. AbstractShortAssertIsNotEqualTo
  3. AbstractShortAssertIsZero
  4. AbstractShortAssertIsNotZero
  5. AbstractShortAssertIsOne

AbstractShortAssertIsEqualTo

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<AbstractShortAssert<?>> testAbstractShortAssertIsEqualTo() {
     return ImmutableSet.of(
-        assertThat((short) 0).isCloseTo((short) 1, offset((short) 0)),
-        assertThat((short) 0).isCloseTo((short) 1, withPercentage(0)));
+        assertThat((short) 0).isEqualTo((short) 1), assertThat((short) 0).isEqualTo((short) 1));
   }

AbstractShortAssertIsNotEqualTo

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<AbstractShortAssert<?>> testAbstractShortAssertIsNotEqualTo() {
     return ImmutableSet.of(
-        assertThat((short) 0).isNotCloseTo((short) 1, offset((short) 0)),
-        assertThat((short) 0).isNotCloseTo((short) 1, withPercentage(0)));
+        assertThat((short) 0).isNotEqualTo((short) 1),
+        assertThat((short) 0).isNotEqualTo((short) 1));
   }

AbstractShortAssertIsZero

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 AbstractShortAssert<?> testAbstractShortAssertIsZero() {
-    return assertThat((short) 0).isZero();
+    return assertThat((short) 0).isEqualTo((short) 0);
   }

AbstractShortAssertIsNotZero

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 AbstractShortAssert<?> testAbstractShortAssertIsNotZero() {
-    return assertThat((short) 0).isNotZero();
+    return assertThat((short) 0).isNotEqualTo((short) 0);
   }

AbstractShortAssertIsOne

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 AbstractShortAssert<?> testAbstractShortAssertIsOne() {
-    return assertThat((short) 0).isOne();
+    return assertThat((short) 0).isEqualTo((short) 1);
   }

Copyright © 2017-2024 Picnic Technologies BV