AssertJIteratorRules

SUGGESTION

Simplification

View source code on GitHub

Suppression

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

Table of contents
  1. AssertThatHasNext
  2. AssertThatIsExhausted

AssertThatHasNext

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 AbstractAssert<?, ?> testAssertThatHasNext() {
-  return assertThat(ImmutableSet.of().iterator().hasNext()).isTrue();
+  return assertThat(ImmutableSet.of().iterator()).hasNext();
 }

AssertThatIsExhausted

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 AbstractAssert<?, ?> testAssertThatIsExhausted() {
-  return assertThat(ImmutableSet.of().iterator().hasNext()).isFalse();
+  return assertThat(ImmutableSet.of().iterator()).isExhausted();
 }

Copyright © 2017-2024 Picnic Technologies BV