AssertJStreamRules
SUGGESTION
Simplification
Suppression
Disable all rules by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJStreamRules\$).*as compiler argument.
Table of contents
AssertThatFilteredOn
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatFilteredOn")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJStreamRules\$AssertThatFilteredOn).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ListAssert<Integer> testAssertThatFilteredOn() {
- return assertThat(Stream.of(1).filter(i -> i > 2));
+ return assertThat(Stream.of(1)).filteredOn(i -> i > 2);
}AssertThatNoneMatch
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatNoneMatch")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJStreamRules\$AssertThatNoneMatch).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testAssertThatNoneMatch() {
- assertThat(Stream.of(1)).filteredOn(i -> i > 2).isEmpty();
- assertThat(Stream.of(3).anyMatch(i -> i > 4)).isFalse();
- assertThat(Stream.of(5).noneMatch(i -> i > 6)).isTrue();
+ assertThat(Stream.of(1)).noneMatch(i -> i > 2);
+ assertThat(Stream.of(3)).noneMatch(i -> i > 4);
+ assertThat(Stream.of(5)).noneMatch(i -> i > 6);
}AssertThatAnyMatch
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatAnyMatch")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJStreamRules\$AssertThatAnyMatch).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<AbstractAssert<?, ?>> testAssertThatAnyMatch() {
return ImmutableSet.of(
- assertThat(Stream.of(1)).filteredOn(i -> i > 2).isNotEmpty(),
- assertThat(Stream.of(3).anyMatch(i -> i > 4)).isTrue(),
- assertThat(Stream.of(5).noneMatch(i -> i > 6)).isFalse());
+ assertThat(Stream.of(1)).anyMatch(i -> i > 2),
+ assertThat(Stream.of(3)).anyMatch(i -> i > 4),
+ assertThat(Stream.of(5)).anyMatch(i -> i > 6));
}AssertThatCollection
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatCollection")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJStreamRules\$AssertThatCollection).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractAssert<?, ?> testAssertThatCollection() {
- return assertThat(ImmutableSet.of("foo").stream());
+ return assertThat(ImmutableSet.of("foo"));
}