AssertJRules
SUGGESTION
Simplification
Suppression
Disable all rules by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJRules\$).*as compiler argument.
Table of contents
- AssertThatHasValueOptionalDouble
- AssertThatHasValueOptionalInt
- AssertThatHasValueOptionalLong
- ObjectEnumerableAssertContains
- ObjectEnumerableAssertDoesNotContain
- ObjectEnumerableAssertContainsExactly
- AssertThatContainsExactlySet
- AssertThatContainsExactlyElementsOfList
- AssertThatHasSameElementsAsSet
- AssertThatContainsExactlyInAnyOrderElementsOfMultiset
- AssertThatContainsEntry
- AssertThatContainsAnyElementsOf
- AssertThatContainsAnyOf
- AssertThatContainsAnyOfVarargs
- AssertThatContainsAll
- AssertThatContains
- AssertThatContainsVarargs
- AssertThatContainsExactlyElementsOfStream
- AssertThatContainsExactlyStream
- AssertThatContainsExactlyVarargs
- AssertThatContainsExactlyInAnyOrderElementsOfStream
- AssertThatContainsExactlyInAnyOrder
- AssertThatContainsExactlyInAnyOrderVarargs
- AssertThatContainsSequence
- AssertThatContainsSequenceVarargs
- AssertThatContainsSubsequence
- AssertThatContainsSubsequenceVarargs
- AssertThatDoesNotContainAnyElementsOf
- AssertThatDoesNotContain
- AssertThatDoesNotContainVarargs
- AssertThatDoesNotContainSequence
- AssertThatDoesNotContainSequenceVarargs
- AssertThatHasSameElementsAsStream
- AssertThatContainsOnly
- AssertThatContainsOnlyVarargs
- AssertThatIsSubsetOf
- AssertThatIsSubsetOfVarargs
- AssertThatAccepts
- AssertThatRejects
AssertThatHasValueOptionalDouble
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatHasValueOptionalDouble")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJRules\$AssertThatHasValueOptionalDouble).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractAssert<?, ?> testAssertThatHasValueOptionalDouble() {
- return assertThat(OptionalDouble.of(1.0).getAsDouble()).isEqualTo(2.0);
+ return assertThat(OptionalDouble.of(1.0)).hasValue(2.0);
}AssertThatHasValueOptionalInt
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatHasValueOptionalInt")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJRules\$AssertThatHasValueOptionalInt).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractAssert<?, ?> testAssertThatHasValueOptionalInt() {
- return assertThat(OptionalInt.of(1).getAsInt()).isEqualTo(2);
+ return assertThat(OptionalInt.of(1)).hasValue(2);
}AssertThatHasValueOptionalLong
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatHasValueOptionalLong")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJRules\$AssertThatHasValueOptionalLong).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractAssert<?, ?> testAssertThatHasValueOptionalLong() {
- return assertThat(OptionalLong.of(1L).getAsLong()).isEqualTo(2L);
+ return assertThat(OptionalLong.of(1L)).hasValue(2L);
}ObjectEnumerableAssertContains
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("ObjectEnumerableAssertContains")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJRules\$ObjectEnumerableAssertContains).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<ObjectEnumerableAssert<?, String>> testObjectEnumerableAssertContains() {
return ImmutableSet.of(
- assertThat(ImmutableList.of("foo")).containsAnyOf("bar"),
- assertThat(ImmutableList.of("baz")).containsSequence("qux"),
- assertThat(ImmutableList.of("quux")).containsSubsequence("corge"));
+ assertThat(ImmutableList.of("foo")).contains("bar"),
+ assertThat(ImmutableList.of("baz")).contains("qux"),
+ assertThat(ImmutableList.of("quux")).contains("corge"));
}ObjectEnumerableAssertDoesNotContain
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("ObjectEnumerableAssertDoesNotContain")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJRules\$ObjectEnumerableAssertDoesNotContain).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ObjectEnumerableAssert<?, String> testObjectEnumerableAssertDoesNotContain() {
- return assertThat(ImmutableList.of("foo")).doesNotContainSequence("bar");
+ return assertThat(ImmutableList.of("foo")).doesNotContain("bar");
}ObjectEnumerableAssertContainsExactly
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("ObjectEnumerableAssertContainsExactly")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJRules\$ObjectEnumerableAssertContainsExactly).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<ObjectEnumerableAssert<?, String>> testObjectEnumerableAssertContainsExactly() {
return ImmutableSet.of(
assertThat(ImmutableList.of("foo")).containsExactlyInAnyOrder(new String[] {"bar"}),
- assertThat(ImmutableList.of("baz")).containsExactlyInAnyOrder("qux"));
+ assertThat(ImmutableList.of("baz")).containsExactly("qux"));
}AssertThatContainsExactlySet
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatContainsExactlySet")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJRules\$AssertThatContainsExactlySet).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ObjectEnumerableAssert<?, String> testAssertThatContainsExactlySet() {
- return assertThat(ImmutableSet.of("foo")).containsOnly("bar");
+ return assertThat(ImmutableSet.of("foo")).containsExactly("bar");
}AssertThatContainsExactlyElementsOfList
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatContainsExactlyElementsOfList")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJRules\$AssertThatContainsExactlyElementsOfList).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ListAssert<String> testAssertThatContainsExactlyElementsOfList() {
- return assertThat(ImmutableList.of("foo")).isEqualTo(ImmutableList.of("bar"));
+ return assertThat(ImmutableList.of("foo")).containsExactlyElementsOf(ImmutableList.of("bar"));
}AssertThatHasSameElementsAsSet
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatHasSameElementsAsSet")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJRules\$AssertThatHasSameElementsAsSet).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<AbstractAssert<?, ?>> testAssertThatHasSameElementsAsSet() {
return ImmutableSet.of(
- assertThat(ImmutableSet.of("foo")).isEqualTo(ImmutableSet.of("bar")),
- assertThat(ImmutableSet.of("baz"))
- .containsExactlyInAnyOrderElementsOf(ImmutableSet.of("qux")));
+ assertThat(ImmutableSet.of("foo")).hasSameElementsAs(ImmutableSet.of("bar")),
+ assertThat(ImmutableSet.of("baz")).hasSameElementsAs(ImmutableSet.of("qux")));
}AssertThatContainsExactlyInAnyOrderElementsOfMultiset
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatContainsExactlyInAnyOrderElementsOfMultiset")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJRules\$AssertThatContainsExactlyInAnyOrderElementsOfMultiset).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractAssert<?, ?> testAssertThatContainsExactlyInAnyOrderElementsOfMultiset() {
- return assertThat(ImmutableMultiset.of("foo")).isEqualTo(ImmutableMultiset.of("bar"));
+ return assertThat(ImmutableMultiset.of("foo"))
+ .containsExactlyInAnyOrderElementsOf(ImmutableMultiset.of("bar"));
}AssertThatContainsEntry
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatContainsEntry")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJRules\$AssertThatContainsEntry).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractAssert<?, ?> testAssertThatContainsEntry() {
- return assertThat(ImmutableMap.<String, Object>of("foo", 1).get("bar")).isEqualTo(2);
+ return assertThat(ImmutableMap.<String, Object>of("foo", 1)).containsEntry("bar", 2);
}AssertThatContainsAnyElementsOf
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatContainsAnyElementsOf")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJRules\$AssertThatContainsAnyElementsOf).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<AbstractAssert<?, ?>> testAssertThatContainsAnyElementsOf() {
return ImmutableSet.of(
- assertThat(Stream.of("foo").collect((Collector<String, Object, Iterable<String>>) null))
- .containsAnyElementsOf(ImmutableList.of("bar")),
- assertThat(Stream.of("baz").collect(toImmutableSet()))
- .containsAnyElementsOf(ImmutableList.of("qux")),
- assertThat(Stream.of("quux").collect(toImmutableList()))
- .containsAnyElementsOf(ImmutableList.of("corge")));
+ assertThat(Stream.of("foo")).containsAnyElementsOf(ImmutableList.of("bar")),
+ assertThat(Stream.of("baz")).containsAnyElementsOf(ImmutableList.of("qux")),
+ assertThat(Stream.of("quux")).containsAnyElementsOf(ImmutableList.of("corge")));
}AssertThatContainsAnyOf
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatContainsAnyOf")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJRules\$AssertThatContainsAnyOf).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<AbstractAssert<?, ?>> testAssertThatContainsAnyOf() {
return ImmutableSet.of(
- assertThat(Stream.of("foo").collect((Collector<String, Object, Iterable<String>>) null))
- .containsAnyOf(new String[] {"bar"}),
- assertThat(Stream.of("baz").collect(toImmutableSet())).containsAnyOf(new String[] {"qux"}),
- assertThat(Stream.of("quux").collect(toImmutableList()))
- .containsAnyOf(new String[] {"corge"}));
+ assertThat(Stream.of("foo")).containsAnyOf(new String[] {"bar"}),
+ assertThat(Stream.of("baz")).containsAnyOf(new String[] {"qux"}),
+ assertThat(Stream.of("quux")).containsAnyOf(new String[] {"corge"}));
}AssertThatContainsAnyOfVarargs
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatContainsAnyOfVarargs")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJRules\$AssertThatContainsAnyOfVarargs).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<AbstractAssert<?, ?>> testAssertThatContainsAnyOfVarargs() {
return ImmutableSet.of(
- assertThat(Stream.of("foo").collect((Collector<String, Object, Iterable<String>>) null))
- .containsAnyOf("bar", "baz"),
- assertThat(Stream.of("qux").collect(toImmutableSet())).containsAnyOf("quux", "corge"),
- assertThat(Stream.of("grault").collect(toImmutableList()))
- .containsAnyOf("garply", "waldo"));
+ assertThat(Stream.of("foo")).containsAnyOf("bar", "baz"),
+ assertThat(Stream.of("qux")).containsAnyOf("quux", "corge"),
+ assertThat(Stream.of("grault")).containsAnyOf("garply", "waldo"));
}AssertThatContainsAll
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatContainsAll")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJRules\$AssertThatContainsAll).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<AbstractAssert<?, ?>> testAssertThatContainsAll() {
return ImmutableSet.of(
- assertThat(Stream.of("foo").collect((Collector<String, Object, Iterable<String>>) null))
- .containsAll(ImmutableList.of("bar")),
- assertThat(Stream.of("baz").collect(toImmutableSet())).containsAll(ImmutableList.of("qux")),
- assertThat(Stream.of("quux").collect(toImmutableList()))
- .containsAll(ImmutableList.of("corge")));
+ assertThat(Stream.of("foo")).containsAll(ImmutableList.of("bar")),
+ assertThat(Stream.of("baz")).containsAll(ImmutableList.of("qux")),
+ assertThat(Stream.of("quux")).containsAll(ImmutableList.of("corge")));
}AssertThatContains
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatContains")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJRules\$AssertThatContains).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<AbstractAssert<?, ?>> testAssertThatContains() {
return ImmutableSet.of(
- assertThat(Stream.of("foo").collect((Collector<String, Object, Iterable<String>>) null))
- .contains(new String[] {"bar"}),
- assertThat(Stream.of("baz").collect(toImmutableSet())).contains(new String[] {"qux"}),
- assertThat(Stream.of("quux").collect(toImmutableList())).contains(new String[] {"corge"}));
+ assertThat(Stream.of("foo")).contains(new String[] {"bar"}),
+ assertThat(Stream.of("baz")).contains(new String[] {"qux"}),
+ assertThat(Stream.of("quux")).contains(new String[] {"corge"}));
}AssertThatContainsVarargs
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatContainsVarargs")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJRules\$AssertThatContainsVarargs).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<AbstractAssert<?, ?>> testAssertThatContainsVarargs() {
return ImmutableSet.of(
- assertThat(Stream.of("foo").collect((Collector<String, Object, Iterable<String>>) null))
- .contains("bar", "baz"),
- assertThat(Stream.of("qux").collect(toImmutableSet())).contains("quux", "corge"),
- assertThat(Stream.of("grault").collect(toImmutableList())).contains("garply", "waldo"));
+ assertThat(Stream.of("foo")).contains("bar", "baz"),
+ assertThat(Stream.of("qux")).contains("quux", "corge"),
+ assertThat(Stream.of("grault")).contains("garply", "waldo"));
}AssertThatContainsExactlyElementsOfStream
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatContainsExactlyElementsOfStream")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJRules\$AssertThatContainsExactlyElementsOfStream).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ListAssert<String> testAssertThatContainsExactlyElementsOfStream() {
- return assertThat(Stream.of("foo").collect(toImmutableList()))
- .containsExactlyElementsOf(ImmutableList.of("bar"));
+ return assertThat(Stream.of("foo")).containsExactlyElementsOf(ImmutableList.of("bar"));
}AssertThatContainsExactlyStream
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatContainsExactlyStream")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJRules\$AssertThatContainsExactlyStream).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ListAssert<String> testAssertThatContainsExactlyStream() {
- return assertThat(Stream.of("foo").collect(toImmutableList()))
- .containsExactly(new String[] {"bar"});
+ return assertThat(Stream.of("foo")).containsExactly(new String[] {"bar"});
}AssertThatContainsExactlyVarargs
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatContainsExactlyVarargs")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJRules\$AssertThatContainsExactlyVarargs).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ListAssert<String> testAssertThatContainsExactlyVarargs() {
- return assertThat(Stream.of("foo").collect(toImmutableList())).containsExactly("bar", "baz");
+ return assertThat(Stream.of("foo")).containsExactly("bar", "baz");
}AssertThatContainsExactlyInAnyOrderElementsOfStream
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatContainsExactlyInAnyOrderElementsOfStream")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJRules\$AssertThatContainsExactlyInAnyOrderElementsOfStream).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<AbstractAssert<?, ?>> testAssertThatContainsExactlyInAnyOrderElementsOfStream() {
return ImmutableSet.of(
- assertThat(Stream.of("foo").collect(toImmutableList()))
- .containsExactlyInAnyOrderElementsOf(ImmutableList.of("bar")),
- assertThat(Stream.of("baz").collect(toImmutableMultiset()))
- .containsExactlyInAnyOrderElementsOf(ImmutableList.of("qux")));
+ assertThat(Stream.of("foo")).containsExactlyInAnyOrderElementsOf(ImmutableList.of("bar")),
+ assertThat(Stream.of("baz")).containsExactlyInAnyOrderElementsOf(ImmutableList.of("qux")));
}AssertThatContainsExactlyInAnyOrder
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatContainsExactlyInAnyOrder")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJRules\$AssertThatContainsExactlyInAnyOrder).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<AbstractAssert<?, ?>> testAssertThatContainsExactlyInAnyOrder() {
return ImmutableSet.of(
- assertThat(Stream.of("foo").collect(toImmutableList()))
- .containsExactlyInAnyOrder(new String[] {"bar"}),
- assertThat(Stream.of("baz").collect(toImmutableMultiset()))
- .containsExactlyInAnyOrder(new String[] {"qux"}));
+ assertThat(Stream.of("foo")).containsExactlyInAnyOrder(new String[] {"bar"}),
+ assertThat(Stream.of("baz")).containsExactlyInAnyOrder(new String[] {"qux"}));
}AssertThatContainsExactlyInAnyOrderVarargs
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatContainsExactlyInAnyOrderVarargs")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJRules\$AssertThatContainsExactlyInAnyOrderVarargs).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<AbstractAssert<?, ?>> testAssertThatContainsExactlyInAnyOrderVarargs() {
return ImmutableSet.of(
- assertThat(Stream.of("foo").collect(toImmutableList()))
- .containsExactlyInAnyOrder("bar", "baz"),
- assertThat(Stream.of("qux").collect(toImmutableMultiset()))
- .containsExactlyInAnyOrder("quux", "corge"));
+ assertThat(Stream.of("foo")).containsExactlyInAnyOrder("bar", "baz"),
+ assertThat(Stream.of("qux")).containsExactlyInAnyOrder("quux", "corge"));
}AssertThatContainsSequence
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatContainsSequence")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJRules\$AssertThatContainsSequence).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<ListAssert<String>> testAssertThatContainsSequence() {
return ImmutableSet.of(
- assertThat(Stream.of("foo").collect(toImmutableList()))
- .containsSequence(ImmutableList.of("bar")),
- assertThat(Stream.of("baz").collect(toImmutableList()))
- .containsSequence(new String[] {"qux"}));
+ assertThat(Stream.of("foo")).containsSequence(ImmutableList.of("bar")),
+ assertThat(Stream.of("baz")).containsSequence(new String[] {"qux"}));
}AssertThatContainsSequenceVarargs
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatContainsSequenceVarargs")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJRules\$AssertThatContainsSequenceVarargs).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ListAssert<String> testAssertThatContainsSequenceVarargs() {
- return assertThat(Stream.of("foo").collect(toImmutableList())).containsSequence("bar", "baz");
+ return assertThat(Stream.of("foo")).containsSequence("bar", "baz");
}AssertThatContainsSubsequence
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatContainsSubsequence")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJRules\$AssertThatContainsSubsequence).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<ListAssert<String>> testAssertThatContainsSubsequence() {
return ImmutableSet.of(
- assertThat(Stream.of("foo").collect(toImmutableList()))
- .containsSubsequence(ImmutableList.of("bar")),
- assertThat(Stream.of("baz").collect(toImmutableList()))
- .containsSubsequence(new String[] {"qux"}));
+ assertThat(Stream.of("foo")).containsSubsequence(ImmutableList.of("bar")),
+ assertThat(Stream.of("baz")).containsSubsequence(new String[] {"qux"}));
}AssertThatContainsSubsequenceVarargs
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatContainsSubsequenceVarargs")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJRules\$AssertThatContainsSubsequenceVarargs).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ListAssert<String> testAssertThatContainsSubsequenceVarargs() {
- return assertThat(Stream.of("foo").collect(toImmutableList()))
- .containsSubsequence("bar", "baz");
+ return assertThat(Stream.of("foo")).containsSubsequence("bar", "baz");
}AssertThatDoesNotContainAnyElementsOf
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatDoesNotContainAnyElementsOf")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJRules\$AssertThatDoesNotContainAnyElementsOf).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<AbstractAssert<?, ?>> testAssertThatDoesNotContainAnyElementsOf() {
return ImmutableSet.of(
- assertThat(Stream.of("foo").collect((Collector<String, Object, Iterable<String>>) null))
- .doesNotContainAnyElementsOf(ImmutableList.of("bar")),
- assertThat(Stream.of("baz").collect(toImmutableSet()))
- .doesNotContainAnyElementsOf(ImmutableList.of("qux")),
- assertThat(Stream.of("quux").collect(toImmutableList()))
- .doesNotContainAnyElementsOf(ImmutableList.of("corge")));
+ assertThat(Stream.of("foo")).doesNotContainAnyElementsOf(ImmutableList.of("bar")),
+ assertThat(Stream.of("baz")).doesNotContainAnyElementsOf(ImmutableList.of("qux")),
+ assertThat(Stream.of("quux")).doesNotContainAnyElementsOf(ImmutableList.of("corge")));
}AssertThatDoesNotContain
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatDoesNotContain")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJRules\$AssertThatDoesNotContain).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<AbstractAssert<?, ?>> testAssertThatDoesNotContain() {
return ImmutableSet.of(
- assertThat(Stream.of("foo").collect((Collector<String, Object, Iterable<String>>) null))
- .doesNotContain(new String[] {"bar"}),
- assertThat(Stream.of("baz").collect(toImmutableSet())).doesNotContain(new String[] {"qux"}),
- assertThat(Stream.of("quux").collect(toImmutableList()))
- .doesNotContain(new String[] {"corge"}));
+ assertThat(Stream.of("foo")).doesNotContain(new String[] {"bar"}),
+ assertThat(Stream.of("baz")).doesNotContain(new String[] {"qux"}),
+ assertThat(Stream.of("quux")).doesNotContain(new String[] {"corge"}));
}AssertThatDoesNotContainVarargs
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatDoesNotContainVarargs")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJRules\$AssertThatDoesNotContainVarargs).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<AbstractAssert<?, ?>> testAssertThatDoesNotContainVarargs() {
return ImmutableSet.of(
- assertThat(Stream.of("foo").collect((Collector<String, Object, Iterable<String>>) null))
- .doesNotContain("bar", "baz"),
- assertThat(Stream.of("qux").collect(toImmutableSet())).doesNotContain("quux", "corge"),
- assertThat(Stream.of("grault").collect(toImmutableList()))
- .doesNotContain("garply", "waldo"));
+ assertThat(Stream.of("foo")).doesNotContain("bar", "baz"),
+ assertThat(Stream.of("qux")).doesNotContain("quux", "corge"),
+ assertThat(Stream.of("grault")).doesNotContain("garply", "waldo"));
}AssertThatDoesNotContainSequence
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatDoesNotContainSequence")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJRules\$AssertThatDoesNotContainSequence).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<ListAssert<String>> testAssertThatDoesNotContainSequence() {
return ImmutableSet.of(
- assertThat(Stream.of("foo").collect(toImmutableList()))
- .doesNotContainSequence(ImmutableList.of("bar")),
- assertThat(Stream.of("baz").collect(toImmutableList()))
- .doesNotContainSequence(new String[] {"qux"}));
+ assertThat(Stream.of("foo")).doesNotContainSequence(ImmutableList.of("bar")),
+ assertThat(Stream.of("baz")).doesNotContainSequence(new String[] {"qux"}));
}AssertThatDoesNotContainSequenceVarargs
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatDoesNotContainSequenceVarargs")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJRules\$AssertThatDoesNotContainSequenceVarargs).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ListAssert<String> testAssertThatDoesNotContainSequenceVarargs() {
- return assertThat(Stream.of("foo").collect(toImmutableList()))
- .doesNotContainSequence("bar", "baz");
+ return assertThat(Stream.of("foo")).doesNotContainSequence("bar", "baz");
}AssertThatHasSameElementsAsStream
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatHasSameElementsAsStream")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJRules\$AssertThatHasSameElementsAsStream).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<AbstractAssert<?, ?>> testAssertThatHasSameElementsAsStream() {
return ImmutableSet.of(
- assertThat(Stream.of("foo").collect((Collector<String, Object, Iterable<String>>) null))
- .hasSameElementsAs(ImmutableList.of("bar")),
- assertThat(Stream.of("baz").collect(toImmutableSet()))
- .hasSameElementsAs(ImmutableList.of("qux")),
- assertThat(Stream.of("quux").collect(toImmutableList()))
- .hasSameElementsAs(ImmutableList.of("corge")));
+ assertThat(Stream.of("foo")).hasSameElementsAs(ImmutableList.of("bar")),
+ assertThat(Stream.of("baz")).hasSameElementsAs(ImmutableList.of("qux")),
+ assertThat(Stream.of("quux")).hasSameElementsAs(ImmutableList.of("corge")));
}AssertThatContainsOnly
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatContainsOnly")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJRules\$AssertThatContainsOnly).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<AbstractAssert<?, ?>> testAssertThatContainsOnly() {
return ImmutableSet.of(
- assertThat(Stream.of("foo").collect((Collector<String, Object, Iterable<String>>) null))
- .containsOnly(new String[] {"bar"}),
- assertThat(Stream.of("baz").collect(toImmutableSet())).containsOnly(new String[] {"qux"}),
- assertThat(Stream.of("quux").collect(toImmutableList()))
- .containsOnly(new String[] {"corge"}));
+ assertThat(Stream.of("foo")).containsOnly(new String[] {"bar"}),
+ assertThat(Stream.of("baz")).containsOnly(new String[] {"qux"}),
+ assertThat(Stream.of("quux")).containsOnly(new String[] {"corge"}));
}AssertThatContainsOnlyVarargs
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatContainsOnlyVarargs")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJRules\$AssertThatContainsOnlyVarargs).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<AbstractAssert<?, ?>> testAssertThatContainsOnlyVarargs() {
return ImmutableSet.of(
- assertThat(Stream.of("foo").collect((Collector<String, Object, Iterable<String>>) null))
- .containsOnly("bar", "baz"),
- assertThat(Stream.of("qux").collect(toImmutableSet())).containsOnly("quux", "corge"),
- assertThat(Stream.of("grault").collect(toImmutableList())).containsOnly("garply", "waldo"));
+ assertThat(Stream.of("foo")).containsOnly("bar", "baz"),
+ assertThat(Stream.of("qux")).containsOnly("quux", "corge"),
+ assertThat(Stream.of("grault")).containsOnly("garply", "waldo"));
}AssertThatIsSubsetOf
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatIsSubsetOf")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJRules\$AssertThatIsSubsetOf).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<AbstractAssert<?, ?>> testAssertThatIsSubsetOf() {
return ImmutableSet.of(
- assertThat(Stream.of("foo").collect((Collector<String, Object, Iterable<String>>) null))
- .isSubsetOf(ImmutableList.of("bar")),
- assertThat(Stream.of("baz").collect((Collector<String, Object, Iterable<String>>) null))
- .isSubsetOf(new String[] {"qux"}),
- assertThat(Stream.of("quux").collect(toImmutableSet()))
- .isSubsetOf(ImmutableList.of("corge")),
- assertThat(Stream.of("grault").collect(toImmutableSet()))
- .isSubsetOf(new String[] {"garply"}),
- assertThat(Stream.of("waldo").collect(toImmutableList()))
- .isSubsetOf(ImmutableList.of("fred")),
- assertThat(Stream.of("plugh").collect(toImmutableList()))
- .isSubsetOf(new String[] {"xyzzy"}));
+ assertThat(Stream.of("foo")).isSubsetOf(ImmutableList.of("bar")),
+ assertThat(Stream.of("baz")).isSubsetOf(new String[] {"qux"}),
+ assertThat(Stream.of("quux")).isSubsetOf(ImmutableList.of("corge")),
+ assertThat(Stream.of("grault")).isSubsetOf(new String[] {"garply"}),
+ assertThat(Stream.of("waldo")).isSubsetOf(ImmutableList.of("fred")),
+ assertThat(Stream.of("plugh")).isSubsetOf(new String[] {"xyzzy"}));
}AssertThatIsSubsetOfVarargs
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatIsSubsetOfVarargs")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJRules\$AssertThatIsSubsetOfVarargs).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<AbstractAssert<?, ?>> testAssertThatIsSubsetOfVarargs() {
return ImmutableSet.of(
- assertThat(Stream.of("foo").collect((Collector<String, Object, Iterable<String>>) null))
- .isSubsetOf("bar", "baz"),
- assertThat(Stream.of("qux").collect(toImmutableSet())).isSubsetOf("quux", "corge"),
- assertThat(Stream.of("grault").collect(toImmutableList())).isSubsetOf("garply", "waldo"));
+ assertThat(Stream.of("foo")).isSubsetOf("bar", "baz"),
+ assertThat(Stream.of("qux")).isSubsetOf("quux", "corge"),
+ assertThat(Stream.of("grault")).isSubsetOf("garply", "waldo"));
}AssertThatAccepts
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatAccepts")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJRules\$AssertThatAccepts).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testAssertThatAccepts() {
- assertThat(((Predicate<String>) String::isEmpty).test("foo")).isTrue();
+ assertThat(((Predicate<String>) String::isEmpty)).accepts("foo");
}AssertThatRejects
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatRejects")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJRules\$AssertThatRejects).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testAssertThatRejects() {
- assertThat(((Predicate<String>) String::isEmpty).test("foo")).isFalse();
+ assertThat(((Predicate<String>) String::isEmpty)).rejects("foo");
}