AssertJObjectRules
SUGGESTION
Simplification
Suppression
Disable all rules by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJObjectRules\$).*
as compiler argument.
Table of contents
AssertThatIsInstanceOf
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatIsInstanceOf")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJObjectRules\$AssertThatIsInstanceOf).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractAssert<?, ?> testAssertThatIsInstanceOf() {
- return assertThat("foo" instanceof String).isTrue();
+ return assertThat("foo").isInstanceOf(String.class);
}
AssertThatIsNotInstanceOf
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatIsNotInstanceOf")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJObjectRules\$AssertThatIsNotInstanceOf).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractAssert<?, ?> testAssertThatIsNotInstanceOf() {
- return assertThat("foo" instanceof String).isFalse();
+ return assertThat("foo").isNotInstanceOf(String.class);
}
AssertThatIsIsEqualTo
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatIsIsEqualTo")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJObjectRules\$AssertThatIsIsEqualTo).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractAssert<?, ?> testAssertThatIsIsEqualTo() {
- return assertThat("foo".equals("bar")).isTrue();
+ return assertThat("foo").isEqualTo("bar");
}
AssertThatIsIsNotEqualTo
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatIsIsNotEqualTo")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJObjectRules\$AssertThatIsIsNotEqualTo).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractAssert<?, ?> testAssertThatIsIsNotEqualTo() {
- return assertThat("foo".equals("bar")).isFalse();
+ return assertThat("foo").isNotEqualTo("bar");
}
AssertThatHasToString
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatHasToString")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJObjectRules\$AssertThatHasToString).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractAssert<?, ?> testAssertThatHasToString() {
- return assertThat(new Object().toString()).isEqualTo("foo");
+ return assertThat(new Object()).hasToString("foo");
}