AssertJArrayRules
SUGGESTION
Simplification
Suppression
Disable all rules by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJArrayRules\$).*
as compiler argument.
Table of contents
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=^(?!AssertJArrayRules\$AssertThatHasSize).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<AbstractAssert<?, ?>> testAssertThatHasSize() {
return ImmutableSet.of(
- assertThat(new String[0].length).isEqualTo(1),
- assertThat(new String[0][0].length).isEqualTo(2));
+ assertThat(new String[0]).hasSize(1), assertThat(new String[0][0].length).isEqualTo(2));
}
AssertThatHasSizeLessThan
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatHasSizeLessThan")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJArrayRules\$AssertThatHasSizeLessThan).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<AbstractAssert<?, ?>> testAssertThatHasSizeLessThan() {
return ImmutableSet.of(
- assertThat(new String[0].length).isLessThan(1),
+ assertThat(new String[0]).hasSizeLessThan(1),
assertThat(new String[0][0].length).isLessThan(2));
}
AssertThatHasSizeLessThanOrEqualTo
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatHasSizeLessThanOrEqualTo")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJArrayRules\$AssertThatHasSizeLessThanOrEqualTo).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<AbstractAssert<?, ?>> testAssertThatHasSizeLessThanOrEqualTo() {
return ImmutableSet.of(
- assertThat(new String[0].length).isLessThanOrEqualTo(1),
+ assertThat(new String[0]).hasSizeLessThanOrEqualTo(1),
assertThat(new String[0][0].length).isLessThanOrEqualTo(2));
}
AssertThatHasSizeGreaterThan
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatHasSizeGreaterThan")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJArrayRules\$AssertThatHasSizeGreaterThan).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<AbstractAssert<?, ?>> testAssertThatHasSizeGreaterThan() {
return ImmutableSet.of(
- assertThat(new String[0].length).isGreaterThan(1),
+ assertThat(new String[0]).hasSizeGreaterThan(1),
assertThat(new String[0][0].length).isGreaterThan(2));
}
AssertThatHasSizeGreaterThanOrEqualTo
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatHasSizeGreaterThanOrEqualTo")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJArrayRules\$AssertThatHasSizeGreaterThanOrEqualTo).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<AbstractAssert<?, ?>> testAssertThatHasSizeGreaterThanOrEqualTo() {
return ImmutableSet.of(
- assertThat(new String[0].length).isGreaterThanOrEqualTo(1),
+ assertThat(new String[0]).hasSizeGreaterThanOrEqualTo(1),
assertThat(new String[0][0].length).isGreaterThanOrEqualTo(2));
}
AssertThatHasSizeBetween
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatHasSizeBetween")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJArrayRules\$AssertThatHasSizeBetween).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<AbstractAssert<?, ?>> testAssertThatHasSizeBetween() {
return ImmutableSet.of(
- assertThat(new String[0].length).isBetween(1, 2),
+ assertThat(new String[0]).hasSizeBetween(1, 2),
assertThat(new String[0][0].length).isBetween(3, 4));
}