AssertJCharSequenceRules
SUGGESTION
Simplification
Suppression
Disable all rules by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJCharSequenceRules\$).*as compiler argument.
Table of contents
AssertThatIsEmpty
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatIsEmpty")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJCharSequenceRules\$AssertThatIsEmpty).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testAssertThatIsEmpty() {
- assertThat("foo".isEmpty()).isTrue();
- assertThat("bar".length()).isEqualTo(0L);
- assertThat("baz".length()).isNotPositive();
+ assertThat("foo").isEmpty();
+ assertThat("bar").isEmpty();
+ assertThat("baz").isEmpty();
}AssertThatIsNotEmpty
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatIsNotEmpty")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJCharSequenceRules\$AssertThatIsNotEmpty).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<AbstractAssert<?, ?>> testAssertThatIsNotEmpty() {
return ImmutableSet.of(
- assertThat("foo".isEmpty()).isFalse(),
- assertThat("bar".length()).isNotEqualTo(0),
- assertThat("baz".length()).isPositive());
+ assertThat("foo").isNotEmpty(),
+ assertThat("bar").isNotEmpty(),
+ assertThat("baz").isNotEmpty());
}AssertThatHasSize
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatHasSize")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJCharSequenceRules\$AssertThatHasSize).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractAssert<?, ?> testAssertThatHasSize() {
- return assertThat("foo".length()).isEqualTo(3);
+ return assertThat("foo").hasSize(3);
}