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

AssertJBooleanRules

SUGGESTION

Simplification

View source code on GitHub

Suppression

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

Table of contents
  1. AbstractBooleanAssertIsEqualTo
  2. AbstractBooleanAssertIsNotEqualTo
  3. AbstractBooleanAssertIsTrue
  4. AssertThatBooleanIsTrue
  5. AbstractBooleanAssertIsFalse
  6. AssertThatBooleanIsFalse

AbstractBooleanAssertIsEqualTo

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 AbstractBooleanAssert<?> testAbstractBooleanAssertIsEqualTo() {
-    return assertThat(true).isNotEqualTo(!Boolean.FALSE);
+    return assertThat(true).isEqualTo(Boolean.FALSE);
   }

AbstractBooleanAssertIsNotEqualTo

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 AbstractBooleanAssert<?> testAbstractBooleanAssertIsNotEqualTo() {
-    return assertThat(true).isEqualTo(!Boolean.FALSE);
+    return assertThat(true).isNotEqualTo(Boolean.FALSE);
   }

AbstractBooleanAssertIsTrue

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<AbstractBooleanAssert<?>> testAbstractBooleanAssertIsTrue() {
     return ImmutableSet.of(
-        assertThat(true).isEqualTo(true),
-        assertThat(true).isEqualTo(Boolean.TRUE),
-        assertThat(true).isNotEqualTo(false),
-        assertThat(true).isNotEqualTo(Boolean.FALSE));
+        assertThat(true).isTrue(),
+        assertThat(true).isTrue(),
+        assertThat(true).isTrue(),
+        assertThat(true).isTrue());
   }

AssertThatBooleanIsTrue

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 AbstractBooleanAssert<?> testAssertThatBooleanIsTrue() {
-    return assertThat(!Boolean.TRUE).isFalse();
+    return assertThat(Boolean.TRUE).isTrue();
   }

AbstractBooleanAssertIsFalse

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<AbstractBooleanAssert<?>> testAbstractBooleanAssertIsFalse() {
     return ImmutableSet.of(
-        assertThat(true).isEqualTo(false),
-        assertThat(true).isEqualTo(Boolean.FALSE),
-        assertThat(true).isNotEqualTo(true),
-        assertThat(true).isNotEqualTo(Boolean.TRUE));
+        assertThat(true).isFalse(),
+        assertThat(true).isFalse(),
+        assertThat(true).isFalse(),
+        assertThat(true).isFalse());
   }

AssertThatBooleanIsFalse

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 AbstractBooleanAssert<?> testAssertThatBooleanIsFalse() {
-    return assertThat(!Boolean.TRUE).isTrue();
+    return assertThat(Boolean.TRUE).isFalse();
   }

Copyright © 2017-2023 Picnic Technologies BV