AssertJStringRules
SUGGESTION
Simplification
Suppression
Disable all rules by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJStringRules\$).*as compiler argument.
Table of contents
- AbstractStringAssertStringIsEmpty
- AbstractStringAssertStringIsNotEmpty
- AssertThatStringStartsWith
- AssertThatStringDoesNotStartWith
- AssertThatStringEndsWith
- AssertThatStringDoesNotEndWith
- AssertThatStringContains
- AssertThatStringDoesNotContain
- AssertThatMatches
- AssertThatDoesNotMatch
- AssertThatPathContent
- AssertThatPathContentUtf8
AbstractStringAssertStringIsEmpty
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AbstractStringAssertStringIsEmpty")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJStringRules\$AbstractStringAssertStringIsEmpty).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testAbstractStringAssertStringIsEmpty() {
- assertThat("foo").isEqualTo("");
+ assertThat("foo").isEmpty();
}AbstractStringAssertStringIsNotEmpty
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AbstractStringAssertStringIsNotEmpty")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJStringRules\$AbstractStringAssertStringIsNotEmpty).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractStringAssert<?> testAbstractStringAssertStringIsNotEmpty() {
- return assertThat("foo").isNotEqualTo("");
+ return assertThat("foo").isNotEmpty();
}AssertThatStringStartsWith
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatStringStartsWith")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJStringRules\$AssertThatStringStartsWith).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractAssert<?, ?> testAssertThatStringStartsWith() {
- return assertThat("foo".startsWith("bar")).isTrue();
+ return assertThat("foo").startsWith("bar");
}AssertThatStringDoesNotStartWith
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatStringDoesNotStartWith")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJStringRules\$AssertThatStringDoesNotStartWith).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractAssert<?, ?> testAssertThatStringDoesNotStartWith() {
- return assertThat("foo".startsWith("bar")).isFalse();
+ return assertThat("foo").doesNotStartWith("bar");
}AssertThatStringEndsWith
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatStringEndsWith")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJStringRules\$AssertThatStringEndsWith).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractAssert<?, ?> testAssertThatStringEndsWith() {
- return assertThat("foo".endsWith("bar")).isTrue();
+ return assertThat("foo").endsWith("bar");
}AssertThatStringDoesNotEndWith
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatStringDoesNotEndWith")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJStringRules\$AssertThatStringDoesNotEndWith).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractAssert<?, ?> testAssertThatStringDoesNotEndWith() {
- return assertThat("foo".endsWith("bar")).isFalse();
+ return assertThat("foo").doesNotEndWith("bar");
}AssertThatStringContains
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatStringContains")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJStringRules\$AssertThatStringContains).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractAssert<?, ?> testAssertThatStringContains() {
- return assertThat("foo".contains("bar")).isTrue();
+ return assertThat("foo").contains("bar");
}AssertThatStringDoesNotContain
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatStringDoesNotContain")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJStringRules\$AssertThatStringDoesNotContain).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractAssert<?, ?> testAssertThatStringDoesNotContain() {
- return assertThat("foo".contains("bar")).isFalse();
+ return assertThat("foo").doesNotContain("bar");
}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(".*")).isTrue();
+ return assertThat("foo").matches(".*");
}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(".*")).isFalse();
+ return assertThat("foo").doesNotMatch(".*");
}AssertThatPathContent
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatPathContent")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJStringRules\$AssertThatPathContent).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractStringAssert<?> testAssertThatPathContent() throws IOException {
- return assertThat(Files.readString(Paths.get(""), Charset.defaultCharset()));
+ return assertThat(Paths.get("")).content(Charset.defaultCharset());
}AssertThatPathContentUtf8
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatPathContentUtf8")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJStringRules\$AssertThatPathContentUtf8).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractStringAssert<?> testAssertThatPathContentUtf8() throws IOException {
- return assertThat(Files.readString(Paths.get("")));
+ return assertThat(Paths.get("")).content(UTF_8);
}