AssertJPathRules

SUGGESTION

Simplification

View source code on GitHub

Suppression

Disable all rules by adding -XepOpt:Refaster:NamePattern=^(?!AssertJPathRules\$).* as compiler argument.

Table of contents
  1. AssertThatExists
  2. AssertThatDoesNotExist
  3. AssertThatIsRegularFile
  4. AssertThatIsDirectory
  5. AssertThatIsSymbolicLink
  6. AssertThatIsAbsolute
  7. AssertThatIsRelative
  8. AssertThatIsReadable
  9. AssertThatIsWritable
  10. AssertThatIsExecutable
  11. AssertThatHasFileName
  12. AssertThatHasParentRaw
  13. AssertThatHasNoParent
  14. AssertThatStartsWithRaw
  15. AssertThatEndsWithRaw
  16. AssertThatHasExtension

AssertThatExists

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("AssertThatExists") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!AssertJPathRules\$AssertThatExists).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 AbstractAssert<?, ?> testAssertThatExists() {
-  return assertThat(Files.exists(Path.of("foo"))).isTrue();
+  return assertThat(Path.of("foo")).exists();
 }

AssertThatDoesNotExist

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("AssertThatDoesNotExist") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!AssertJPathRules\$AssertThatDoesNotExist).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 AbstractAssert<?, ?> testAssertThatDoesNotExist() {
-  return assertThat(Files.exists(Path.of("foo"))).isFalse();
+  return assertThat(Path.of("foo")).doesNotExist();
 }

AssertThatIsRegularFile

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("AssertThatIsRegularFile") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!AssertJPathRules\$AssertThatIsRegularFile).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 AbstractAssert<?, ?> testAssertThatIsRegularFile() {
-  return assertThat(Files.isRegularFile(Path.of("foo"))).isTrue();
+  return assertThat(Path.of("foo")).isRegularFile();
 }

AssertThatIsDirectory

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("AssertThatIsDirectory") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!AssertJPathRules\$AssertThatIsDirectory).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 AbstractAssert<?, ?> testAssertThatIsDirectory() {
-  return assertThat(Files.isDirectory(Path.of("foo"))).isTrue();
+  return assertThat(Path.of("foo")).isDirectory();
 }

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("AssertThatIsSymbolicLink") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!AssertJPathRules\$AssertThatIsSymbolicLink).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 AbstractAssert<?, ?> testAssertThatIsSymbolicLink() {
-  return assertThat(Files.isSymbolicLink(Path.of("foo"))).isTrue();
+  return assertThat(Path.of("foo")).isSymbolicLink();
 }

AssertThatIsAbsolute

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("AssertThatIsAbsolute") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!AssertJPathRules\$AssertThatIsAbsolute).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 AbstractAssert<?, ?> testAssertThatIsAbsolute() {
-  return assertThat(Path.of("foo").isAbsolute()).isTrue();
+  return assertThat(Path.of("foo")).isAbsolute();
 }

AssertThatIsRelative

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("AssertThatIsRelative") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!AssertJPathRules\$AssertThatIsRelative).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 AbstractAssert<?, ?> testAssertThatIsRelative() {
-  return assertThat(Path.of("foo").isAbsolute()).isFalse();
+  return assertThat(Path.of("foo")).isRelative();
 }

AssertThatIsReadable

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("AssertThatIsReadable") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!AssertJPathRules\$AssertThatIsReadable).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 AbstractAssert<?, ?> testAssertThatIsReadable() {
-  return assertThat(Files.isReadable(Path.of("foo"))).isTrue();
+  return assertThat(Path.of("foo")).isReadable();
 }

AssertThatIsWritable

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("AssertThatIsWritable") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!AssertJPathRules\$AssertThatIsWritable).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 AbstractAssert<?, ?> testAssertThatIsWritable() {
-  return assertThat(Files.isWritable(Path.of("foo"))).isTrue();
+  return assertThat(Path.of("foo")).isWritable();
 }

AssertThatIsExecutable

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("AssertThatIsExecutable") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!AssertJPathRules\$AssertThatIsExecutable).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 AbstractAssert<?, ?> testAssertThatIsExecutable() {
-  return assertThat(Files.isExecutable(Path.of("foo"))).isTrue();
+  return assertThat(Path.of("foo")).isExecutable();
 }

AssertThatHasFileName

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("AssertThatHasFileName") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!AssertJPathRules\$AssertThatHasFileName).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 AbstractAssert<?, ?> testAssertThatHasFileName() {
-  return assertThat(Path.of("foo").getFileName()).hasToString("bar");
+  return assertThat(Path.of("foo")).hasFileName("bar");
 }

AssertThatHasParentRaw

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("AssertThatHasParentRaw") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!AssertJPathRules\$AssertThatHasParentRaw).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 AbstractAssert<?, ?> testAssertThatHasParentRaw() {
-  return assertThat(Path.of("foo").getParent()).isEqualTo(Path.of("bar"));
+  return assertThat(Path.of("foo")).hasParentRaw(Path.of("bar"));
 }

AssertThatHasNoParent

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("AssertThatHasNoParent") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!AssertJPathRules\$AssertThatHasNoParent).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 void testAssertThatHasNoParent() {
-  assertThat(Path.of("foo").getParent()).isNull();
+  assertThat(Path.of("foo")).hasNoParent();
 }

AssertThatStartsWithRaw

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("AssertThatStartsWithRaw") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!AssertJPathRules\$AssertThatStartsWithRaw).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 AbstractAssert<?, ?> testAssertThatStartsWithRaw() {
-  return assertThat(Path.of("foo").startsWith(Path.of("bar"))).isTrue();
+  return assertThat(Path.of("foo")).startsWithRaw(Path.of("bar"));
 }

AssertThatEndsWithRaw

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("AssertThatEndsWithRaw") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!AssertJPathRules\$AssertThatEndsWithRaw).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 AbstractAssert<?, ?> testAssertThatEndsWithRaw() {
-  return assertThat(Path.of("foo").endsWith(Path.of("bar"))).isTrue();
+  return assertThat(Path.of("foo")).endsWithRaw(Path.of("bar"));
 }

AssertThatHasExtension

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("AssertThatHasExtension") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!AssertJPathRules\$AssertThatHasExtension).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 ImmutableSet<AbstractAssert<?, ?>> testAssertThatHasExtension() {
   return ImmutableSet.of(
-      assertThat(Path.of("foo").toString()).endsWith('.' + "bar"),
-      assertThat(Path.of("baz").getFileName().toString()).endsWith('.' + "qux"),
-      assertThat(Path.of("quux").toString()).endsWith("." + toString()),
-      assertThat(Path.of("corge").getFileName().toString())
-          .endsWith("." + getClass().toString()));
+      assertThat(Path.of("foo")).hasExtension("bar"),
+      assertThat(Path.of("baz")).hasExtension("qux"),
+      assertThat(Path.of("quux")).hasExtension(toString()),
+      assertThat(Path.of("corge")).hasExtension(getClass().toString()));
 }

Copyright © 2017-2024 Picnic Technologies BV