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

AssertJByteRules

SUGGESTION

Simplification

View source code on GitHub

Suppression

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

Table of contents
  1. AbstractByteAssertIsEqualTo
  2. AbstractByteAssertIsNotEqualTo
  3. AbstractByteAssertIsZero
  4. AbstractByteAssertIsNotZero
  5. AbstractByteAssertIsOne

AbstractByteAssertIsEqualTo

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<AbstractByteAssert<?>> testAbstractByteAssertIsEqualTo() {
     return ImmutableSet.of(
-        assertThat((byte) 0).isCloseTo((byte) 1, offset((byte) 0)),
-        assertThat((byte) 0).isCloseTo((byte) 1, withPercentage(0)));
+        assertThat((byte) 0).isEqualTo((byte) 1), assertThat((byte) 0).isEqualTo((byte) 1));
   }

AbstractByteAssertIsNotEqualTo

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<AbstractByteAssert<?>> testAbstractByteAssertIsNotEqualTo() {
     return ImmutableSet.of(
-        assertThat((byte) 0).isNotCloseTo((byte) 1, offset((byte) 0)),
-        assertThat((byte) 0).isNotCloseTo((byte) 1, withPercentage(0)));
+        assertThat((byte) 0).isNotEqualTo((byte) 1), assertThat((byte) 0).isNotEqualTo((byte) 1));
   }

AbstractByteAssertIsZero

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 AbstractByteAssert<?> testAbstractByteAssertIsZero() {
-    return assertThat((byte) 0).isZero();
+    return assertThat((byte) 0).isEqualTo((byte) 0);
   }

AbstractByteAssertIsNotZero

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 AbstractByteAssert<?> testAbstractByteAssertIsNotZero() {
-    return assertThat((byte) 0).isNotZero();
+    return assertThat((byte) 0).isNotEqualTo((byte) 0);
   }

AbstractByteAssertIsOne

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 AbstractByteAssert<?> testAbstractByteAssertIsOne() {
-    return assertThat((byte) 0).isOne();
+    return assertThat((byte) 0).isEqualTo((byte) 1);
   }

Copyright © 2017-2023 Picnic Technologies BV