AssertJStringRules
SUGGESTION
Simplification
Suppression
Disable all rules by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJStringRules\$).*as compiler argument.
Table of contents
- AbstractStringAssertIsEmpty
- AbstractStringAssertIsNotEmpty
- AssertThatStartsWith
- AssertThatDoesNotStartWith
- AssertThatEndsWith
- AssertThatDoesNotEndWith
- AssertThatContains
- AssertThatDoesNotContain
- AssertThatIsEqualToIgnoringCase
- AssertThatIsNotEqualToIgnoringCase
- AssertThatIsBlank
- AssertThatIsNotBlank
- AssertThatMatches
- AssertThatDoesNotMatch
- AssertThatContent
- AssertThatContentUtf8
AbstractStringAssertIsEmpty
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AbstractStringAssertIsEmpty")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJStringRules\$AbstractStringAssertIsEmpty).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testAbstractStringAssertIsEmpty() {
- assertThat("foo").isEqualTo("");
+ assertThat("foo").isEmpty();
}AbstractStringAssertIsNotEmpty
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AbstractStringAssertIsNotEmpty")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJStringRules\$AbstractStringAssertIsNotEmpty).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractStringAssert<?> testAbstractStringAssertIsNotEmpty() {
- return assertThat("foo").isNotEqualTo("");
+ return assertThat("foo").isNotEmpty();
}AssertThatStartsWith
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatStartsWith")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJStringRules\$AssertThatStartsWith).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractAssert<?, ?> testAssertThatStartsWith() {
- return assertThat("foo".startsWith("bar")).isTrue();
+ return assertThat("foo").startsWith("bar");
}AssertThatDoesNotStartWith
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatDoesNotStartWith")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJStringRules\$AssertThatDoesNotStartWith).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractAssert<?, ?> testAssertThatDoesNotStartWith() {
- return assertThat("foo".startsWith("bar")).isFalse();
+ return assertThat("foo").doesNotStartWith("bar");
}AssertThatEndsWith
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatEndsWith")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJStringRules\$AssertThatEndsWith).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractAssert<?, ?> testAssertThatEndsWith() {
- return assertThat("foo".endsWith("bar")).isTrue();
+ return assertThat("foo").endsWith("bar");
}AssertThatDoesNotEndWith
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatDoesNotEndWith")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJStringRules\$AssertThatDoesNotEndWith).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractAssert<?, ?> testAssertThatDoesNotEndWith() {
- return assertThat("foo".endsWith("bar")).isFalse();
+ return assertThat("foo").doesNotEndWith("bar");
}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=^(?!AssertJStringRules\$AssertThatContains).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractAssert<?, ?> testAssertThatContains() {
- return assertThat("foo".contains("bar")).isTrue();
+ return assertThat("foo").contains("bar");
}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=^(?!AssertJStringRules\$AssertThatDoesNotContain).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractAssert<?, ?> testAssertThatDoesNotContain() {
- return assertThat("foo".contains("bar")).isFalse();
+ return assertThat("foo").doesNotContain("bar");
}AssertThatIsEqualToIgnoringCase
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatIsEqualToIgnoringCase")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJStringRules\$AssertThatIsEqualToIgnoringCase).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractAssert<?, ?> testAssertThatIsEqualToIgnoringCase() {
- return assertThat("foo".equalsIgnoreCase("bar")).isTrue();
+ return assertThat("foo").isEqualToIgnoringCase("bar");
}AssertThatIsNotEqualToIgnoringCase
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatIsNotEqualToIgnoringCase")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJStringRules\$AssertThatIsNotEqualToIgnoringCase).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractAssert<?, ?> testAssertThatIsNotEqualToIgnoringCase() {
- return assertThat("foo".equalsIgnoreCase("bar")).isFalse();
+ return assertThat("foo").isNotEqualToIgnoringCase("bar");
}AssertThatIsBlank
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatIsBlank")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJStringRules\$AssertThatIsBlank).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testAssertThatIsBlank() {
- assertThat("foo".isBlank()).isTrue();
+ assertThat("foo").isBlank();
}AssertThatIsNotBlank
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatIsNotBlank")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJStringRules\$AssertThatIsNotBlank).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractAssert<?, ?> testAssertThatIsNotBlank() {
- return assertThat("foo".isBlank()).isFalse();
+ return assertThat("foo").isNotBlank();
}AssertThatMatches
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatMatches")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJStringRules\$AssertThatMatches).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractAssert<?, ?> testAssertThatMatches() {
- return assertThat("foo".matches("bar")).isTrue();
+ return assertThat("foo").matches("bar");
}AssertThatDoesNotMatch
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatDoesNotMatch")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJStringRules\$AssertThatDoesNotMatch).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractAssert<?, ?> testAssertThatDoesNotMatch() {
- return assertThat("foo".matches("bar")).isFalse();
+ return assertThat("foo").doesNotMatch("bar");
}AssertThatContent
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatContent")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJStringRules\$AssertThatContent).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractStringAssert<?> testAssertThatContent() throws IOException {
- return assertThat(Files.readString(Paths.get(""), Charset.defaultCharset()));
+ return assertThat(Paths.get("")).content(Charset.defaultCharset());
}AssertThatContentUtf8
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatContentUtf8")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJStringRules\$AssertThatContentUtf8).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractStringAssert<?> testAssertThatContentUtf8() throws IOException {
- return assertThat(Files.readString(Paths.get("")));
+ return assertThat(Paths.get("")).content(UTF_8);
}