AssertJEnumerableRules
SUGGESTION
Simplification
Suppression
Disable all rules by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJEnumerableRules\$).*
as compiler argument.
Table of contents
EnumerableAssertIsEmpty
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("EnumerableAssertIsEmpty")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJEnumerableRules\$EnumerableAssertIsEmpty).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testEnumerableAssertIsEmpty() {
- assertThat(ImmutableSet.of(1)).hasSize(0);
- assertThat(ImmutableSet.of(2)).hasSizeLessThanOrEqualTo(0);
- assertThat(ImmutableSet.of(3)).hasSizeLessThan(1);
- assertThat(ImmutableSet.of(4)).size().isNotPositive();
+ assertThat(ImmutableSet.of(1)).isEmpty();
+ assertThat(ImmutableSet.of(2)).isEmpty();
+ assertThat(ImmutableSet.of(3)).isEmpty();
+ assertThat(ImmutableSet.of(4)).isEmpty();
}
EnumerableAssertIsNotEmpty
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("EnumerableAssertIsNotEmpty")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJEnumerableRules\$EnumerableAssertIsNotEmpty).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<AbstractAssert<?, ?>> testEnumerableAssertIsNotEmpty() {
return ImmutableSet.of(
- assertThat(ImmutableSet.of(1)).hasSizeGreaterThan(0),
- assertThat(ImmutableSet.of(2)).hasSizeGreaterThanOrEqualTo(1),
- assertThat(ImmutableSet.of(3)).size().isNotEqualTo(0).returnToIterable(),
- assertThat(ImmutableSet.of(4)).size().isPositive().returnToIterable(),
- assertThat(ImmutableSet.of(5)).size().isNotEqualTo(0),
- assertThat(ImmutableSet.of(6)).size().isPositive());
+ assertThat(ImmutableSet.of(1)).isNotEmpty(),
+ assertThat(ImmutableSet.of(2)).isNotEmpty(),
+ assertThat(ImmutableSet.of(3)).isNotEmpty(),
+ assertThat(ImmutableSet.of(4)).isNotEmpty(),
+ assertThat(ImmutableSet.of(5)).isNotEmpty(),
+ assertThat(ImmutableSet.of(6)).isNotEmpty());
}
EnumerableAssertHasSize
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("EnumerableAssertHasSize")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJEnumerableRules\$EnumerableAssertHasSize).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<AbstractAssert<?, ?>> testEnumerableAssertHasSize() {
return ImmutableSet.of(
- assertThat(ImmutableSet.of(1)).size().isEqualTo(2).returnToIterable(),
- assertThat(ImmutableSet.of(3)).size().isEqualTo(4));
+ assertThat(ImmutableSet.of(1)).hasSize(2), assertThat(ImmutableSet.of(3)).hasSize(4));
}
EnumerableAssertHasSizeLessThan
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("EnumerableAssertHasSizeLessThan")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJEnumerableRules\$EnumerableAssertHasSizeLessThan).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<AbstractAssert<?, ?>> testEnumerableAssertHasSizeLessThan() {
return ImmutableSet.of(
- assertThat(ImmutableSet.of(1)).size().isLessThan(2).returnToIterable(),
- assertThat(ImmutableSet.of(3)).size().isLessThan(4));
+ assertThat(ImmutableSet.of(1)).hasSizeLessThan(2),
+ assertThat(ImmutableSet.of(3)).hasSizeLessThan(4));
}
EnumerableAssertHasSizeLessThanOrEqualTo
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("EnumerableAssertHasSizeLessThanOrEqualTo")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJEnumerableRules\$EnumerableAssertHasSizeLessThanOrEqualTo).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<AbstractAssert<?, ?>> testEnumerableAssertHasSizeLessThanOrEqualTo() {
return ImmutableSet.of(
- assertThat(ImmutableSet.of(1)).size().isLessThanOrEqualTo(2).returnToIterable(),
- assertThat(ImmutableSet.of(3)).size().isLessThanOrEqualTo(4));
+ assertThat(ImmutableSet.of(1)).hasSizeLessThanOrEqualTo(2),
+ assertThat(ImmutableSet.of(3)).hasSizeLessThanOrEqualTo(4));
}
EnumerableAssertHasSizeGreaterThan
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("EnumerableAssertHasSizeGreaterThan")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJEnumerableRules\$EnumerableAssertHasSizeGreaterThan).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<AbstractAssert<?, ?>> testEnumerableAssertHasSizeGreaterThan() {
return ImmutableSet.of(
- assertThat(ImmutableSet.of(1)).size().isGreaterThan(2).returnToIterable(),
- assertThat(ImmutableSet.of(3)).size().isGreaterThan(4));
+ assertThat(ImmutableSet.of(1)).hasSizeGreaterThan(2),
+ assertThat(ImmutableSet.of(3)).hasSizeGreaterThan(4));
}
EnumerableAssertHasSizeGreaterThanOrEqualTo
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("EnumerableAssertHasSizeGreaterThanOrEqualTo")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJEnumerableRules\$EnumerableAssertHasSizeGreaterThanOrEqualTo).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<AbstractAssert<?, ?>> testEnumerableAssertHasSizeGreaterThanOrEqualTo() {
return ImmutableSet.of(
- assertThat(ImmutableSet.of(1)).size().isGreaterThanOrEqualTo(2).returnToIterable(),
- assertThat(ImmutableSet.of(3)).size().isGreaterThanOrEqualTo(4));
+ assertThat(ImmutableSet.of(1)).hasSizeGreaterThanOrEqualTo(2),
+ assertThat(ImmutableSet.of(3)).hasSizeGreaterThanOrEqualTo(4));
}
EnumerableAssertHasSizeBetween
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("EnumerableAssertHasSizeBetween")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJEnumerableRules\$EnumerableAssertHasSizeBetween).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<AbstractAssert<?, ?>> testEnumerableAssertHasSizeBetween() {
return ImmutableSet.of(
- assertThat(ImmutableSet.of(1)).size().isBetween(2, 3).returnToIterable(),
- assertThat(ImmutableSet.of(4)).size().isBetween(5, 6));
+ assertThat(ImmutableSet.of(1)).hasSizeBetween(2, 3),
+ assertThat(ImmutableSet.of(4)).hasSizeBetween(5, 6));
}
EnumerableAssertHasSameSizeAs
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("EnumerableAssertHasSameSizeAs")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJEnumerableRules\$EnumerableAssertHasSameSizeAs).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<EnumerableAssert<?, Integer>> testEnumerableAssertHasSameSizeAs() {
return ImmutableSet.of(
- assertThat(ImmutableSet.of(1)).hasSize(Iterables.size(ImmutableSet.of(2))),
- assertThat(ImmutableSet.of(3)).hasSize(ImmutableSet.of(4).size()),
- assertThat(ImmutableSet.of(5)).hasSize(new Integer[0].length));
+ assertThat(ImmutableSet.of(1)).hasSameSizeAs(ImmutableSet.of(2)),
+ assertThat(ImmutableSet.of(3)).hasSameSizeAs(ImmutableSet.of(4)),
+ assertThat(ImmutableSet.of(5)).hasSameSizeAs(new Integer[0]));
}