JUnitToAssertJRules

SUGGESTION

Simplification

View source code on GitHub

Suppression

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

Table of contents
  1. AssertThatContainsExactlyBoolean
  2. AssertThatWithFailMessageContainsExactlyBooleanString
  3. AssertThatWithFailMessageContainsExactlyBooleanSupplier
  4. AssertThatContainsExactlyByte
  5. AssertThatWithFailMessageContainsExactlyByteString
  6. AssertThatWithFailMessageContainsExactlyByteSupplier
  7. AssertThatContainsExactlyChar
  8. AssertThatWithFailMessageContainsExactlyCharString
  9. AssertThatWithFailMessageContainsExactlyCharSupplier
  10. AssertThatContainsExactlyShort
  11. AssertThatWithFailMessageContainsExactlyShortString
  12. AssertThatWithFailMessageContainsExactlyShortSupplier
  13. AssertThatContainsExactlyInt
  14. AssertThatWithFailMessageContainsExactlyIntString
  15. AssertThatWithFailMessageContainsExactlyIntSupplier
  16. AssertThatContainsExactlyLong
  17. AssertThatWithFailMessageContainsExactlyLongString
  18. AssertThatWithFailMessageContainsExactlyLongSupplier
  19. AssertThatContainsExactlyFloat
  20. AssertThatWithFailMessageContainsExactlyFloatString
  21. AssertThatWithFailMessageContainsExactlyFloatSupplier
  22. AssertThatContainsExactlyOffsetFloat
  23. AssertThatWithFailMessageContainsExactlyOffsetFloatString
  24. AssertThatWithFailMessageContainsExactlyOffsetFloatSupplier
  25. AssertThatContainsExactlyDouble
  26. AssertThatWithFailMessageContainsExactlyDoubleString
  27. AssertThatWithFailMessageContainsExactlyDoubleSupplier
  28. AssertThatContainsExactlyOffsetDouble
  29. AssertThatWithFailMessageContainsExactlyOffsetDoubleString
  30. AssertThatWithFailMessageContainsExactlyOffsetDoubleSupplier
  31. AssertThatContainsExactlyObject
  32. AssertThatWithFailMessageContainsExactlyObjectString
  33. AssertThatWithFailMessageContainsExactlyObjectSupplier
  34. Fail
  35. FailWithString
  36. FailWithStringAndThrowable
  37. FailWithThrowable
  38. AssertThatIsTrue
  39. AssertThatWithFailMessageIsTrueString
  40. AssertThatWithFailMessageIsTrueSupplier
  41. AssertThatIsFalse
  42. AssertThatWithFailMessageIsFalseString
  43. AssertThatWithFailMessageIsFalseSupplier
  44. AssertThatIsNull
  45. AssertThatWithFailMessageIsNullString
  46. AssertThatWithFailMessageIsNullSupplier
  47. AssertThatIsNotNull
  48. AssertThatWithFailMessageIsNotNullString
  49. AssertThatWithFailMessageIsNotNullSupplier
  50. AssertThatIsSameAs
  51. AssertThatWithFailMessageIsSameAsString
  52. AssertThatWithFailMessageIsSameAsSupplier
  53. AssertThatIsNotSameAs
  54. AssertThatWithFailMessageIsNotSameAsString
  55. AssertThatWithFailMessageIsNotSameAsSupplier
  56. AssertThatThrownByIsExactlyInstanceOf
  57. AssertThatThrownByWithFailMessageIsExactlyInstanceOfString
  58. AssertThatThrownByWithFailMessageIsExactlyInstanceOfSupplier
  59. AssertThatThrownByIsInstanceOf
  60. AssertThatThrownByWithFailMessageIsInstanceOfString
  61. AssertThatThrownByWithFailMessageIsInstanceOfSupplier
  62. AssertThatCodeDoesNotThrowAnyException
  63. AssertThatCodeWithFailMessageDoesNotThrowAnyExceptionString
  64. AssertThatCodeWithFailMessageDoesNotThrowAnyExceptionSupplier
  65. AssertThatIsInstanceOf
  66. AssertThatWithFailMessageIsInstanceOfString
  67. AssertThatWithFailMessageIsInstanceOfSupplier

AssertThatContainsExactlyBoolean

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 void testAssertThatContainsExactlyBoolean() {
-  assertArrayEquals(new boolean[] {true}, new boolean[] {false});
+  assertThat(new boolean[] {false}).containsExactly(new boolean[] {true});
 }

AssertThatWithFailMessageContainsExactlyBooleanString

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 void testAssertThatWithFailMessageContainsExactlyBooleanString() {
-  assertArrayEquals(new boolean[] {true}, new boolean[] {false}, "foo");
+  assertThat(new boolean[] {false}).withFailMessage("foo").containsExactly(new boolean[] {true});
 }

AssertThatWithFailMessageContainsExactlyBooleanSupplier

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 void testAssertThatWithFailMessageContainsExactlyBooleanSupplier() {
-  assertArrayEquals(new boolean[] {true}, new boolean[] {false}, () -> "foo");
+  assertThat(new boolean[] {false})
+      .withFailMessage(() -> "foo")
+      .containsExactly(new boolean[] {true});
 }

AssertThatContainsExactlyByte

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 void testAssertThatContainsExactlyByte() {
-  assertArrayEquals(new byte[] {1}, new byte[] {2});
+  assertThat(new byte[] {2}).containsExactly(new byte[] {1});
 }

AssertThatWithFailMessageContainsExactlyByteString

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 void testAssertThatWithFailMessageContainsExactlyByteString() {
-  assertArrayEquals(new byte[] {1}, new byte[] {2}, "foo");
+  assertThat(new byte[] {2}).withFailMessage("foo").containsExactly(new byte[] {1});
 }

AssertThatWithFailMessageContainsExactlyByteSupplier

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 void testAssertThatWithFailMessageContainsExactlyByteSupplier() {
-  assertArrayEquals(new byte[] {1}, new byte[] {2}, () -> "foo");
+  assertThat(new byte[] {2}).withFailMessage(() -> "foo").containsExactly(new byte[] {1});
 }

AssertThatContainsExactlyChar

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 void testAssertThatContainsExactlyChar() {
-  assertArrayEquals(new char[] {'a'}, new char[] {'b'});
+  assertThat(new char[] {'b'}).containsExactly(new char[] {'a'});
 }

AssertThatWithFailMessageContainsExactlyCharString

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 void testAssertThatWithFailMessageContainsExactlyCharString() {
-  assertArrayEquals(new char[] {'a'}, new char[] {'b'}, "foo");
+  assertThat(new char[] {'b'}).withFailMessage("foo").containsExactly(new char[] {'a'});
 }

AssertThatWithFailMessageContainsExactlyCharSupplier

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 void testAssertThatWithFailMessageContainsExactlyCharSupplier() {
-  assertArrayEquals(new char[] {'a'}, new char[] {'b'}, () -> "foo");
+  assertThat(new char[] {'b'}).withFailMessage(() -> "foo").containsExactly(new char[] {'a'});
 }

AssertThatContainsExactlyShort

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 void testAssertThatContainsExactlyShort() {
-  assertArrayEquals(new short[] {1}, new short[] {2});
+  assertThat(new short[] {2}).containsExactly(new short[] {1});
 }

AssertThatWithFailMessageContainsExactlyShortString

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 void testAssertThatWithFailMessageContainsExactlyShortString() {
-  assertArrayEquals(new short[] {1}, new short[] {2}, "foo");
+  assertThat(new short[] {2}).withFailMessage("foo").containsExactly(new short[] {1});
 }

AssertThatWithFailMessageContainsExactlyShortSupplier

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 void testAssertThatWithFailMessageContainsExactlyShortSupplier() {
-  assertArrayEquals(new short[] {1}, new short[] {2}, () -> "foo");
+  assertThat(new short[] {2}).withFailMessage(() -> "foo").containsExactly(new short[] {1});
 }

AssertThatContainsExactlyInt

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 void testAssertThatContainsExactlyInt() {
-  assertArrayEquals(new int[] {1}, new int[] {2});
+  assertThat(new int[] {2}).containsExactly(new int[] {1});
 }

AssertThatWithFailMessageContainsExactlyIntString

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 void testAssertThatWithFailMessageContainsExactlyIntString() {
-  assertArrayEquals(new int[] {1}, new int[] {2}, "foo");
+  assertThat(new int[] {2}).withFailMessage("foo").containsExactly(new int[] {1});
 }

AssertThatWithFailMessageContainsExactlyIntSupplier

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 void testAssertThatWithFailMessageContainsExactlyIntSupplier() {
-  assertArrayEquals(new int[] {1}, new int[] {2}, () -> "foo");
+  assertThat(new int[] {2}).withFailMessage(() -> "foo").containsExactly(new int[] {1});
 }

AssertThatContainsExactlyLong

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 void testAssertThatContainsExactlyLong() {
-  assertArrayEquals(new long[] {1L}, new long[] {2L});
+  assertThat(new long[] {2L}).containsExactly(new long[] {1L});
 }

AssertThatWithFailMessageContainsExactlyLongString

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 void testAssertThatWithFailMessageContainsExactlyLongString() {
-  assertArrayEquals(new long[] {1L}, new long[] {2L}, "foo");
+  assertThat(new long[] {2L}).withFailMessage("foo").containsExactly(new long[] {1L});
 }

AssertThatWithFailMessageContainsExactlyLongSupplier

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 void testAssertThatWithFailMessageContainsExactlyLongSupplier() {
-  assertArrayEquals(new long[] {1L}, new long[] {2L}, () -> "foo");
+  assertThat(new long[] {2L}).withFailMessage(() -> "foo").containsExactly(new long[] {1L});
 }

AssertThatContainsExactlyFloat

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 void testAssertThatContainsExactlyFloat() {
-  assertArrayEquals(new float[] {1.0f}, new float[] {2.0f});
+  assertThat(new float[] {2.0f}).containsExactly(new float[] {1.0f});
 }

AssertThatWithFailMessageContainsExactlyFloatString

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 void testAssertThatWithFailMessageContainsExactlyFloatString() {
-  assertArrayEquals(new float[] {1.0f}, new float[] {2.0f}, "foo");
+  assertThat(new float[] {2.0f}).withFailMessage("foo").containsExactly(new float[] {1.0f});
 }

AssertThatWithFailMessageContainsExactlyFloatSupplier

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 void testAssertThatWithFailMessageContainsExactlyFloatSupplier() {
-  assertArrayEquals(new float[] {1.0f}, new float[] {2.0f}, () -> "foo");
+  assertThat(new float[] {2.0f}).withFailMessage(() -> "foo").containsExactly(new float[] {1.0f});
 }

AssertThatContainsExactlyOffsetFloat

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 void testAssertThatContainsExactlyOffsetFloat() {
-  assertArrayEquals(new float[] {1.0f}, new float[] {2.0f}, 0.1f);
+  assertThat(new float[] {2.0f}).containsExactly(new float[] {1.0f}, offset(0.1f));
 }

AssertThatWithFailMessageContainsExactlyOffsetFloatString

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 void testAssertThatWithFailMessageContainsExactlyOffsetFloatString() {
-  assertArrayEquals(new float[] {1.0f}, new float[] {2.0f}, 0.1f, "foo");
+  assertThat(new float[] {2.0f})
+      .withFailMessage("foo")
+      .containsExactly(new float[] {1.0f}, offset(0.1f));
 }

AssertThatWithFailMessageContainsExactlyOffsetFloatSupplier

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 void testAssertThatWithFailMessageContainsExactlyOffsetFloatSupplier() {
-  assertArrayEquals(new float[] {1.0f}, new float[] {2.0f}, 0.1f, () -> "foo");
+  assertThat(new float[] {2.0f})
+      .withFailMessage(() -> "foo")
+      .containsExactly(new float[] {1.0f}, offset(0.1f));
 }

AssertThatContainsExactlyDouble

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 void testAssertThatContainsExactlyDouble() {
-  assertArrayEquals(new double[] {1.0}, new double[] {2.0});
+  assertThat(new double[] {2.0}).containsExactly(new double[] {1.0});
 }

AssertThatWithFailMessageContainsExactlyDoubleString

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 void testAssertThatWithFailMessageContainsExactlyDoubleString() {
-  assertArrayEquals(new double[] {1.0}, new double[] {2.0}, "foo");
+  assertThat(new double[] {2.0}).withFailMessage("foo").containsExactly(new double[] {1.0});
 }

AssertThatWithFailMessageContainsExactlyDoubleSupplier

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 void testAssertThatWithFailMessageContainsExactlyDoubleSupplier() {
-  assertArrayEquals(new double[] {1.0}, new double[] {2.0}, () -> "foo");
+  assertThat(new double[] {2.0}).withFailMessage(() -> "foo").containsExactly(new double[] {1.0});
 }

AssertThatContainsExactlyOffsetDouble

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 void testAssertThatContainsExactlyOffsetDouble() {
-  assertArrayEquals(new double[] {1.0}, new double[] {2.0}, 0.1);
+  assertThat(new double[] {2.0}).containsExactly(new double[] {1.0}, offset(0.1));
 }

AssertThatWithFailMessageContainsExactlyOffsetDoubleString

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 void testAssertThatWithFailMessageContainsExactlyOffsetDoubleString() {
-  assertArrayEquals(new double[] {1.0}, new double[] {2.0}, 0.1, "foo");
+  assertThat(new double[] {2.0})
+      .withFailMessage("foo")
+      .containsExactly(new double[] {1.0}, offset(0.1));
 }

AssertThatWithFailMessageContainsExactlyOffsetDoubleSupplier

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 void testAssertThatWithFailMessageContainsExactlyOffsetDoubleSupplier() {
-  assertArrayEquals(new double[] {1.0}, new double[] {2.0}, 0.1, () -> "foo");
+  assertThat(new double[] {2.0})
+      .withFailMessage(() -> "foo")
+      .containsExactly(new double[] {1.0}, offset(0.1));
 }

AssertThatContainsExactlyObject

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 void testAssertThatContainsExactlyObject() {
-  assertArrayEquals(new Object[] {"foo"}, new Object[] {"bar"});
+  assertThat(new Object[] {"bar"}).containsExactly(new Object[] {"foo"});
 }

AssertThatWithFailMessageContainsExactlyObjectString

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 void testAssertThatWithFailMessageContainsExactlyObjectString() {
-  assertArrayEquals(new Object[] {"foo"}, new Object[] {"bar"}, "foo");
+  assertThat(new Object[] {"bar"}).withFailMessage("foo").containsExactly(new Object[] {"foo"});
 }

AssertThatWithFailMessageContainsExactlyObjectSupplier

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 void testAssertThatWithFailMessageContainsExactlyObjectSupplier() {
-  assertArrayEquals(new Object[] {"foo"}, new Object[] {"bar"}, () -> "foo");
+  assertThat(new Object[] {"bar"})
+      .withFailMessage(() -> "foo")
+      .containsExactly(new Object[] {"foo"});
 }

Fail

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 Object testFail() {
-  return Assertions.fail();
+  return org.assertj.core.api.Assertions.fail();
 }

FailWithString

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 Object testFailWithString() {
-  return Assertions.fail("foo");
+  return org.assertj.core.api.Assertions.fail("foo");
 }

FailWithStringAndThrowable

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 Object testFailWithStringAndThrowable() {
-  return Assertions.fail("foo", new IllegalStateException());
+  return org.assertj.core.api.Assertions.fail("foo", new IllegalStateException());
 }

FailWithThrowable

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 Object testFailWithThrowable() {
-  return Assertions.fail(new IllegalStateException());
+  return org.assertj.core.api.Assertions.fail(new IllegalStateException());
 }

AssertThatIsTrue

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 void testAssertThatIsTrue() {
-  assertTrue(true);
+  assertThat(true).isTrue();
 }

AssertThatWithFailMessageIsTrueString

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 void testAssertThatWithFailMessageIsTrueString() {
-  assertTrue(true, "foo");
+  assertThat(true).withFailMessage("foo").isTrue();
 }

AssertThatWithFailMessageIsTrueSupplier

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 void testAssertThatWithFailMessageIsTrueSupplier() {
-  assertTrue(true, () -> "foo");
+  assertThat(true).withFailMessage(() -> "foo").isTrue();
 }

AssertThatIsFalse

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 void testAssertThatIsFalse() {
-  assertFalse(true);
+  assertThat(true).isFalse();
 }

AssertThatWithFailMessageIsFalseString

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 void testAssertThatWithFailMessageIsFalseString() {
-  assertFalse(true, "foo");
+  assertThat(true).withFailMessage("foo").isFalse();
 }

AssertThatWithFailMessageIsFalseSupplier

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 void testAssertThatWithFailMessageIsFalseSupplier() {
-  assertFalse(true, () -> "foo");
+  assertThat(true).withFailMessage(() -> "foo").isFalse();
 }

AssertThatIsNull

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 void testAssertThatIsNull() {
-  assertNull(new Object());
+  assertThat(new Object()).isNull();
 }

AssertThatWithFailMessageIsNullString

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 void testAssertThatWithFailMessageIsNullString() {
-  assertNull(new Object(), "foo");
+  assertThat(new Object()).withFailMessage("foo").isNull();
 }

AssertThatWithFailMessageIsNullSupplier

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 void testAssertThatWithFailMessageIsNullSupplier() {
-  assertNull(new Object(), () -> "foo");
+  assertThat(new Object()).withFailMessage(() -> "foo").isNull();
 }

AssertThatIsNotNull

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 void testAssertThatIsNotNull() {
-  assertNotNull(new Object());
+  assertThat(new Object()).isNotNull();
 }

AssertThatWithFailMessageIsNotNullString

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 void testAssertThatWithFailMessageIsNotNullString() {
-  assertNotNull(new Object(), "foo");
+  assertThat(new Object()).withFailMessage("foo").isNotNull();
 }

AssertThatWithFailMessageIsNotNullSupplier

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 void testAssertThatWithFailMessageIsNotNullSupplier() {
-  assertNotNull(new Object(), () -> "foo");
+  assertThat(new Object()).withFailMessage(() -> "foo").isNotNull();
 }

AssertThatIsSameAs

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 void testAssertThatIsSameAs() {
-  assertSame("foo", "bar");
+  assertThat("bar").isSameAs("foo");
 }

AssertThatWithFailMessageIsSameAsString

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 void testAssertThatWithFailMessageIsSameAsString() {
-  assertSame("foo", "bar", "baz");
+  assertThat("bar").withFailMessage("baz").isSameAs("foo");
 }

AssertThatWithFailMessageIsSameAsSupplier

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 void testAssertThatWithFailMessageIsSameAsSupplier() {
-  assertSame("foo", "bar", () -> "baz");
+  assertThat("bar").withFailMessage(() -> "baz").isSameAs("foo");
 }

AssertThatIsNotSameAs

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 void testAssertThatIsNotSameAs() {
-  assertNotSame("foo", "bar");
+  assertThat("bar").isNotSameAs("foo");
 }

AssertThatWithFailMessageIsNotSameAsString

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 void testAssertThatWithFailMessageIsNotSameAsString() {
-  assertNotSame("foo", "bar", "baz");
+  assertThat("bar").withFailMessage("baz").isNotSameAs("foo");
 }

AssertThatWithFailMessageIsNotSameAsSupplier

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 void testAssertThatWithFailMessageIsNotSameAsSupplier() {
-  assertNotSame("foo", "bar", () -> "baz");
+  assertThat("bar").withFailMessage(() -> "baz").isNotSameAs("foo");
 }

AssertThatThrownByIsExactlyInstanceOf

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 void testAssertThatThrownByIsExactlyInstanceOf() {
   assertThrowsExactly(IllegalStateException.class, (Executable) null);
-  assertThrowsExactly(IllegalStateException.class, () -> {});
+  assertThatThrownBy(() -> {}).isExactlyInstanceOf(IllegalStateException.class);
 }

AssertThatThrownByWithFailMessageIsExactlyInstanceOfString

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 void testAssertThatThrownByWithFailMessageIsExactlyInstanceOfString() {
   assertThrowsExactly(IllegalStateException.class, (Executable) null, "foo");
-  assertThrowsExactly(IllegalStateException.class, () -> {}, "foo");
+  assertThatThrownBy(() -> {})
+      .withFailMessage("foo")
+      .isExactlyInstanceOf(IllegalStateException.class);
 }

AssertThatThrownByWithFailMessageIsExactlyInstanceOfSupplier

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 void testAssertThatThrownByWithFailMessageIsExactlyInstanceOfSupplier() {
   assertThrowsExactly(IllegalStateException.class, (Executable) null, () -> "foo");
-  assertThrowsExactly(IllegalStateException.class, () -> {}, () -> "foo");
+  assertThatThrownBy(() -> {})
+      .withFailMessage(() -> "foo")
+      .isExactlyInstanceOf(IllegalStateException.class);
 }

AssertThatThrownByIsInstanceOf

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 void testAssertThatThrownByIsInstanceOf() {
   assertThrows(IllegalStateException.class, (Executable) null);
-  assertThrows(IllegalStateException.class, () -> {});
+  assertThatThrownBy(() -> {}).isInstanceOf(IllegalStateException.class);
 }

AssertThatThrownByWithFailMessageIsInstanceOfString

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 void testAssertThatThrownByWithFailMessageIsInstanceOfString() {
   assertThrows(IllegalStateException.class, (Executable) null, "foo");
-  assertThrows(IllegalStateException.class, () -> {}, "foo");
+  assertThatThrownBy(() -> {}).withFailMessage("foo").isInstanceOf(IllegalStateException.class);
 }

AssertThatThrownByWithFailMessageIsInstanceOfSupplier

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 void testAssertThatThrownByWithFailMessageIsInstanceOfSupplier() {
   assertThrows(IllegalStateException.class, (Executable) null, () -> "foo");
-  assertThrows(IllegalStateException.class, () -> {}, () -> "foo");
+  assertThatThrownBy(() -> {})
+      .withFailMessage(() -> "foo")
+      .isInstanceOf(IllegalStateException.class);
 }

AssertThatCodeDoesNotThrowAnyException

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 void testAssertThatCodeDoesNotThrowAnyException() {
   assertDoesNotThrow((Executable) null);
-  assertDoesNotThrow(() -> {});
+  assertThatCode(() -> {}).doesNotThrowAnyException();
   assertDoesNotThrow((ThrowingSupplier<String>) null);
-  assertDoesNotThrow(() -> toString());
+  assertThatCode(() -> toString()).doesNotThrowAnyException();
 }

AssertThatCodeWithFailMessageDoesNotThrowAnyExceptionString

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 void testAssertThatCodeWithFailMessageDoesNotThrowAnyExceptionString() {
   assertDoesNotThrow((Executable) null);
-  assertDoesNotThrow(() -> {}, "foo");
+  assertThatCode(() -> {}).withFailMessage("foo").doesNotThrowAnyException();
   assertDoesNotThrow((ThrowingSupplier<String>) null, "bar");
-  assertDoesNotThrow(() -> toString(), "bar");
+  assertThatCode(() -> toString()).withFailMessage("bar").doesNotThrowAnyException();
 }

AssertThatCodeWithFailMessageDoesNotThrowAnyExceptionSupplier

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 void testAssertThatCodeWithFailMessageDoesNotThrowAnyExceptionSupplier() {
   assertDoesNotThrow((Executable) null, () -> "foo");
-  assertDoesNotThrow(() -> {}, () -> "foo");
+  assertThatCode(() -> {}).withFailMessage(() -> "foo").doesNotThrowAnyException();
   assertDoesNotThrow((ThrowingSupplier<String>) null, () -> "bar");
-  assertDoesNotThrow(() -> toString(), () -> "bar");
+  assertThatCode(() -> toString()).withFailMessage(() -> "bar").doesNotThrowAnyException();
 }

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=^(?!JUnitToAssertJRules\$AssertThatIsInstanceOf).* as compiler argument.

Samples

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

 void testAssertThatIsInstanceOf() {
-  assertInstanceOf(Object.class, new Object());
+  assertThat(new Object()).isInstanceOf(Object.class);
 }

AssertThatWithFailMessageIsInstanceOfString

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 void testAssertThatWithFailMessageIsInstanceOfString() {
-  assertInstanceOf(Object.class, new Object(), "foo");
+  assertThat(new Object()).withFailMessage("foo").isInstanceOf(Object.class);
 }

AssertThatWithFailMessageIsInstanceOfSupplier

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 void testAssertThatWithFailMessageIsInstanceOfSupplier() {
-  assertInstanceOf(Object.class, new Object(), () -> "foo");
+  assertThat(new Object()).withFailMessage(() -> "foo").isInstanceOf(Object.class);
 }

Copyright © 2017-2026 Picnic Technologies BV