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. AbstractShortAssertIsEqualToZero
  4. AbstractShortAssertIsNotEqualToZero
  5. AbstractShortAssertIsEqualToOne

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) 1).isCloseTo((short) 2, offset((short) 0)),
-      assertThat((short) 1).isCloseTo((short) 2, withPercentage(0)));
+      assertThat((short) 1).isEqualTo((short) 2), assertThat((short) 1).isEqualTo((short) 2));
 }

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) 1).isNotCloseTo((short) 2, offset((short) 0)),
-      assertThat((short) 1).isNotCloseTo((short) 2, withPercentage(0)));
+      assertThat((short) 1).isNotEqualTo((short) 2),
+      assertThat((short) 1).isNotEqualTo((short) 2));
 }

AbstractShortAssertIsEqualToZero

SUGGESTION

Simplification

Suppression

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

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

Samples

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

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

AbstractShortAssertIsNotEqualToZero

SUGGESTION

Simplification

Suppression

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

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

Samples

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

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

AbstractShortAssertIsEqualToOne

SUGGESTION

Simplification

Suppression

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

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

Samples

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

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

Copyright © 2017-2026 Picnic Technologies BV