JUnitToAssertJRules
SUGGESTION
Simplification
Suppression
Disable all rules by adding
-XepOpt:Refaster:NamePattern=^(?!JUnitToAssertJRules\$).*
as compiler argument.
Table of contents
- AssertThatBooleanArrayContainsExactly
- AssertThatBooleanArrayWithFailMessageContainsExactly
- AssertThatBooleanArrayWithFailMessageSupplierContainsExactly
- AssertThatByteArrayContainsExactly
- AssertThatByteArrayWithFailMessageContainsExactly
- AssertThatByteArrayWithFailMessageSupplierContainsExactly
- AssertThatCharArrayContainsExactly
- AssertThatCharArrayWithFailMessageContainsExactly
- AssertThatCharArrayWithFailMessageSupplierContainsExactly
- AssertThatShortArrayContainsExactly
- AssertThatShortArrayWithFailMessageContainsExactly
- AssertThatShortArrayWithFailMessageSupplierContainsExactly
- AssertThatIntArrayContainsExactly
- AssertThatIntArrayWithFailMessageContainsExactly
- AssertThatIntArrayWithFailMessageSupplierContainsExactly
- AssertThatLongArrayContainsExactly
- AssertThatLongArrayWithFailMessageContainsExactly
- AssertThatLongArrayWithFailMessageSupplierContainsExactly
- AssertThatFloatArrayContainsExactly
- AssertThatFloatArrayWithFailMessageContainsExactly
- AssertThatFloatArrayWithFailMessageSupplierContainsExactly
- AssertThatFloatArrayContainsExactlyWithOffset
- AssertThatFloatArrayWithFailMessageContainsExactlyWithOffset
- AssertThatFloatArrayWithFailMessageSupplierContainsExactlyWithOffset
- AssertThatDoubleArrayContainsExactly
- AssertThatDoubleArrayWithFailMessageContainsExactly
- AssertThatDoubleArrayWithFailMessageSupplierContainsExactly
- AssertThatDoubleArrayContainsExactlyWithOffset
- AssertThatDoubleArrayWithFailMessageContainsExactlyWithOffset
- AssertThatDoubleArrayWithFailMessageSupplierContainsExactlyWithOffset
- AssertThatObjectArrayContainsExactly
- AssertThatObjectArrayWithFailMessageContainsExactly
- AssertThatObjectArrayWithFailMessageSupplierContainsExactly
- Fail
- FailWithMessage
- FailWithMessageAndThrowable
- FailWithThrowable
- AssertThatIsTrue
- AssertThatWithFailMessageStringIsTrue
- AssertThatWithFailMessageSupplierIsTrue
- AssertThatIsFalse
- AssertThatWithFailMessageStringIsFalse
- AssertThatWithFailMessageSupplierIsFalse
- AssertThatIsNull
- AssertThatWithFailMessageStringIsNull
- AssertThatWithFailMessageSupplierIsNull
- AssertThatIsNotNull
- AssertThatWithFailMessageStringIsNotNull
- AssertThatWithFailMessageSupplierIsNotNull
- AssertThatIsSameAs
- AssertThatWithFailMessageStringIsSameAs
- AssertThatWithFailMessageSupplierIsSameAs
- AssertThatIsNotSameAs
- AssertThatWithFailMessageStringIsNotSameAs
- AssertThatWithFailMessageSupplierIsNotSameAs
- AssertThatThrownByIsExactlyInstanceOf
- AssertThatThrownByWithFailMessageStringIsExactlyInstanceOf
- AssertThatThrownByWithFailMessageSupplierIsExactlyInstanceOf
- AssertThatThrownByIsInstanceOf
- AssertThatThrownByWithFailMessageStringIsInstanceOf
- AssertThatThrownByWithFailMessageSupplierIsInstanceOf
- AssertThatCodeDoesNotThrowAnyException
- AssertThatCodeWithFailMessageStringDoesNotThrowAnyException
- AssertThatCodeWithFailMessageSupplierDoesNotThrowAnyException
- AssertThatIsInstanceOf
- AssertThatWithFailMessageStringIsInstanceOf
- AssertThatWithFailMessageSupplierIsInstanceOf
AssertThatBooleanArrayContainsExactly
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatBooleanArrayContainsExactly")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!JUnitToAssertJRules\$AssertThatBooleanArrayContainsExactly).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testAssertThatBooleanArrayContainsExactly() {
- assertArrayEquals(new boolean[] {true}, new boolean[] {false});
+ assertThat(new boolean[] {false}).containsExactly(new boolean[] {true});
}
AssertThatBooleanArrayWithFailMessageContainsExactly
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatBooleanArrayWithFailMessageContainsExactly")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!JUnitToAssertJRules\$AssertThatBooleanArrayWithFailMessageContainsExactly).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testAssertThatBooleanArrayWithFailMessageContainsExactly() {
- assertArrayEquals(new boolean[] {true}, new boolean[] {false}, "foo");
+ assertThat(new boolean[] {false}).withFailMessage("foo").containsExactly(new boolean[] {true});
}
AssertThatBooleanArrayWithFailMessageSupplierContainsExactly
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatBooleanArrayWithFailMessageSupplierContainsExactly")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!JUnitToAssertJRules\$AssertThatBooleanArrayWithFailMessageSupplierContainsExactly).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testAssertThatBooleanArrayWithFailMessageSupplierContainsExactly() {
- assertArrayEquals(new boolean[] {true}, new boolean[] {false}, () -> "foo");
+ assertThat(new boolean[] {false})
+ .withFailMessage(() -> "foo")
+ .containsExactly(new boolean[] {true});
}
AssertThatByteArrayContainsExactly
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatByteArrayContainsExactly")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!JUnitToAssertJRules\$AssertThatByteArrayContainsExactly).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testAssertThatByteArrayContainsExactly() {
- assertArrayEquals(new byte[] {1}, new byte[] {2});
+ assertThat(new byte[] {2}).containsExactly(new byte[] {1});
}
AssertThatByteArrayWithFailMessageContainsExactly
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatByteArrayWithFailMessageContainsExactly")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!JUnitToAssertJRules\$AssertThatByteArrayWithFailMessageContainsExactly).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testAssertThatByteArrayWithFailMessageContainsExactly() {
- assertArrayEquals(new byte[] {1}, new byte[] {2}, "foo");
+ assertThat(new byte[] {2}).withFailMessage("foo").containsExactly(new byte[] {1});
}
AssertThatByteArrayWithFailMessageSupplierContainsExactly
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatByteArrayWithFailMessageSupplierContainsExactly")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!JUnitToAssertJRules\$AssertThatByteArrayWithFailMessageSupplierContainsExactly).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testAssertThatByteArrayWithFailMessageSupplierContainsExactly() {
- assertArrayEquals(new byte[] {1}, new byte[] {2}, () -> "foo");
+ assertThat(new byte[] {2}).withFailMessage(() -> "foo").containsExactly(new byte[] {1});
}
AssertThatCharArrayContainsExactly
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatCharArrayContainsExactly")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!JUnitToAssertJRules\$AssertThatCharArrayContainsExactly).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testAssertThatCharArrayContainsExactly() {
- assertArrayEquals(new char[] {'a'}, new char[] {'b'});
+ assertThat(new char[] {'b'}).containsExactly(new char[] {'a'});
}
AssertThatCharArrayWithFailMessageContainsExactly
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatCharArrayWithFailMessageContainsExactly")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!JUnitToAssertJRules\$AssertThatCharArrayWithFailMessageContainsExactly).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testAssertThatCharArrayWithFailMessageContainsExactly() {
- assertArrayEquals(new char[] {'a'}, new char[] {'b'}, "foo");
+ assertThat(new char[] {'b'}).withFailMessage("foo").containsExactly(new char[] {'a'});
}
AssertThatCharArrayWithFailMessageSupplierContainsExactly
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatCharArrayWithFailMessageSupplierContainsExactly")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!JUnitToAssertJRules\$AssertThatCharArrayWithFailMessageSupplierContainsExactly).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testAssertThatCharArrayWithFailMessageSupplierContainsExactly() {
- assertArrayEquals(new char[] {'a'}, new char[] {'b'}, () -> "foo");
+ assertThat(new char[] {'b'}).withFailMessage(() -> "foo").containsExactly(new char[] {'a'});
}
AssertThatShortArrayContainsExactly
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatShortArrayContainsExactly")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!JUnitToAssertJRules\$AssertThatShortArrayContainsExactly).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testAssertThatShortArrayContainsExactly() {
- assertArrayEquals(new short[] {1}, new short[] {2});
+ assertThat(new short[] {2}).containsExactly(new short[] {1});
}
AssertThatShortArrayWithFailMessageContainsExactly
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatShortArrayWithFailMessageContainsExactly")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!JUnitToAssertJRules\$AssertThatShortArrayWithFailMessageContainsExactly).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testAssertThatShortArrayWithFailMessageContainsExactly() {
- assertArrayEquals(new short[] {1}, new short[] {2}, "foo");
+ assertThat(new short[] {2}).withFailMessage("foo").containsExactly(new short[] {1});
}
AssertThatShortArrayWithFailMessageSupplierContainsExactly
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatShortArrayWithFailMessageSupplierContainsExactly")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!JUnitToAssertJRules\$AssertThatShortArrayWithFailMessageSupplierContainsExactly).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testAssertThatShortArrayWithFailMessageSupplierContainsExactly() {
- assertArrayEquals(new short[] {1}, new short[] {2}, () -> "foo");
+ assertThat(new short[] {2}).withFailMessage(() -> "foo").containsExactly(new short[] {1});
}
AssertThatIntArrayContainsExactly
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatIntArrayContainsExactly")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!JUnitToAssertJRules\$AssertThatIntArrayContainsExactly).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testAssertThatIntArrayContainsExactly() {
- assertArrayEquals(new int[] {1}, new int[] {2});
+ assertThat(new int[] {2}).containsExactly(new int[] {1});
}
AssertThatIntArrayWithFailMessageContainsExactly
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatIntArrayWithFailMessageContainsExactly")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!JUnitToAssertJRules\$AssertThatIntArrayWithFailMessageContainsExactly).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testAssertThatIntArrayWithFailMessageContainsExactly() {
- assertArrayEquals(new int[] {1}, new int[] {2}, "foo");
+ assertThat(new int[] {2}).withFailMessage("foo").containsExactly(new int[] {1});
}
AssertThatIntArrayWithFailMessageSupplierContainsExactly
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatIntArrayWithFailMessageSupplierContainsExactly")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!JUnitToAssertJRules\$AssertThatIntArrayWithFailMessageSupplierContainsExactly).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testAssertThatIntArrayWithFailMessageSupplierContainsExactly() {
- assertArrayEquals(new int[] {1}, new int[] {2}, () -> "foo");
+ assertThat(new int[] {2}).withFailMessage(() -> "foo").containsExactly(new int[] {1});
}
AssertThatLongArrayContainsExactly
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatLongArrayContainsExactly")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!JUnitToAssertJRules\$AssertThatLongArrayContainsExactly).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testAssertThatLongArrayContainsExactly() {
- assertArrayEquals(new long[] {1L}, new long[] {2L});
+ assertThat(new long[] {2L}).containsExactly(new long[] {1L});
}
AssertThatLongArrayWithFailMessageContainsExactly
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatLongArrayWithFailMessageContainsExactly")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!JUnitToAssertJRules\$AssertThatLongArrayWithFailMessageContainsExactly).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testAssertThatLongArrayWithFailMessageContainsExactly() {
- assertArrayEquals(new long[] {1L}, new long[] {2L}, "foo");
+ assertThat(new long[] {2L}).withFailMessage("foo").containsExactly(new long[] {1L});
}
AssertThatLongArrayWithFailMessageSupplierContainsExactly
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatLongArrayWithFailMessageSupplierContainsExactly")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!JUnitToAssertJRules\$AssertThatLongArrayWithFailMessageSupplierContainsExactly).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testAssertThatLongArrayWithFailMessageSupplierContainsExactly() {
- assertArrayEquals(new long[] {1L}, new long[] {2L}, () -> "foo");
+ assertThat(new long[] {2L}).withFailMessage(() -> "foo").containsExactly(new long[] {1L});
}
AssertThatFloatArrayContainsExactly
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatFloatArrayContainsExactly")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!JUnitToAssertJRules\$AssertThatFloatArrayContainsExactly).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testAssertThatFloatArrayContainsExactly() {
- assertArrayEquals(new float[] {1.0F}, new float[] {2.0F});
+ assertThat(new float[] {2.0F}).containsExactly(new float[] {1.0F});
}
AssertThatFloatArrayWithFailMessageContainsExactly
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatFloatArrayWithFailMessageContainsExactly")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!JUnitToAssertJRules\$AssertThatFloatArrayWithFailMessageContainsExactly).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testAssertThatFloatArrayWithFailMessageContainsExactly() {
- assertArrayEquals(new float[] {1.0F}, new float[] {2.0F}, "foo");
+ assertThat(new float[] {2.0F}).withFailMessage("foo").containsExactly(new float[] {1.0F});
}
AssertThatFloatArrayWithFailMessageSupplierContainsExactly
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatFloatArrayWithFailMessageSupplierContainsExactly")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!JUnitToAssertJRules\$AssertThatFloatArrayWithFailMessageSupplierContainsExactly).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testAssertThatFloatArrayWithFailMessageSupplierContainsExactly() {
- assertArrayEquals(new float[] {1.0F}, new float[] {2.0F}, () -> "foo");
+ assertThat(new float[] {2.0F}).withFailMessage(() -> "foo").containsExactly(new float[] {1.0F});
}
AssertThatFloatArrayContainsExactlyWithOffset
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatFloatArrayContainsExactlyWithOffset")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!JUnitToAssertJRules\$AssertThatFloatArrayContainsExactlyWithOffset).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testAssertThatFloatArrayContainsExactlyWithOffset() {
- assertArrayEquals(new float[] {1.0F}, new float[] {2.0F}, 0.1f);
+ assertThat(new float[] {2.0F}).containsExactly(new float[] {1.0F}, offset(0.1f));
}
AssertThatFloatArrayWithFailMessageContainsExactlyWithOffset
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatFloatArrayWithFailMessageContainsExactlyWithOffset")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!JUnitToAssertJRules\$AssertThatFloatArrayWithFailMessageContainsExactlyWithOffset).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testAssertThatFloatArrayWithFailMessageContainsExactlyWithOffset() {
- 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));
}
AssertThatFloatArrayWithFailMessageSupplierContainsExactlyWithOffset
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatFloatArrayWithFailMessageSupplierContainsExactlyWithOffset")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!JUnitToAssertJRules\$AssertThatFloatArrayWithFailMessageSupplierContainsExactlyWithOffset).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testAssertThatFloatArrayWithFailMessageSupplierContainsExactlyWithOffset() {
- 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));
}
AssertThatDoubleArrayContainsExactly
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatDoubleArrayContainsExactly")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!JUnitToAssertJRules\$AssertThatDoubleArrayContainsExactly).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testAssertThatDoubleArrayContainsExactly() {
- assertArrayEquals(new double[] {1.0}, new double[] {2.0});
+ assertThat(new double[] {2.0}).containsExactly(new double[] {1.0});
}
AssertThatDoubleArrayWithFailMessageContainsExactly
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatDoubleArrayWithFailMessageContainsExactly")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!JUnitToAssertJRules\$AssertThatDoubleArrayWithFailMessageContainsExactly).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testAssertThatDoubleArrayWithFailMessageContainsExactly() {
- assertArrayEquals(new double[] {1.0}, new double[] {2.0}, "foo");
+ assertThat(new double[] {2.0}).withFailMessage("foo").containsExactly(new double[] {1.0});
}
AssertThatDoubleArrayWithFailMessageSupplierContainsExactly
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatDoubleArrayWithFailMessageSupplierContainsExactly")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!JUnitToAssertJRules\$AssertThatDoubleArrayWithFailMessageSupplierContainsExactly).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testAssertThatDoubleArrayWithFailMessageSupplierContainsExactly() {
- assertArrayEquals(new double[] {1.0}, new double[] {2.0}, () -> "foo");
+ assertThat(new double[] {2.0}).withFailMessage(() -> "foo").containsExactly(new double[] {1.0});
}
AssertThatDoubleArrayContainsExactlyWithOffset
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatDoubleArrayContainsExactlyWithOffset")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!JUnitToAssertJRules\$AssertThatDoubleArrayContainsExactlyWithOffset).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testAssertThatDoubleArrayContainsExactlyWithOffset() {
- assertArrayEquals(new double[] {1.0}, new double[] {2.0}, 0.1);
+ assertThat(new double[] {2.0}).containsExactly(new double[] {1.0}, offset(0.1));
}
AssertThatDoubleArrayWithFailMessageContainsExactlyWithOffset
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatDoubleArrayWithFailMessageContainsExactlyWithOffset")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!JUnitToAssertJRules\$AssertThatDoubleArrayWithFailMessageContainsExactlyWithOffset).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testAssertThatDoubleArrayWithFailMessageContainsExactlyWithOffset() {
- 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));
}
AssertThatDoubleArrayWithFailMessageSupplierContainsExactlyWithOffset
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatDoubleArrayWithFailMessageSupplierContainsExactlyWithOffset")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!JUnitToAssertJRules\$AssertThatDoubleArrayWithFailMessageSupplierContainsExactlyWithOffset).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testAssertThatDoubleArrayWithFailMessageSupplierContainsExactlyWithOffset() {
- 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));
}
AssertThatObjectArrayContainsExactly
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatObjectArrayContainsExactly")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!JUnitToAssertJRules\$AssertThatObjectArrayContainsExactly).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testAssertThatObjectArrayContainsExactly() {
- assertArrayEquals(new Object[] {"foo"}, new Object[] {"bar"});
+ assertThat(new Object[] {"bar"}).containsExactly(new Object[] {"foo"});
}
AssertThatObjectArrayWithFailMessageContainsExactly
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatObjectArrayWithFailMessageContainsExactly")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!JUnitToAssertJRules\$AssertThatObjectArrayWithFailMessageContainsExactly).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testAssertThatObjectArrayWithFailMessageContainsExactly() {
- assertArrayEquals(new Object[] {"foo"}, new Object[] {"bar"}, "foo");
+ assertThat(new Object[] {"bar"}).withFailMessage("foo").containsExactly(new Object[] {"foo"});
}
AssertThatObjectArrayWithFailMessageSupplierContainsExactly
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatObjectArrayWithFailMessageSupplierContainsExactly")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!JUnitToAssertJRules\$AssertThatObjectArrayWithFailMessageSupplierContainsExactly).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testAssertThatObjectArrayWithFailMessageSupplierContainsExactly() {
- 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();
}
FailWithMessage
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("FailWithMessage")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!JUnitToAssertJRules\$FailWithMessage).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Object testFailWithMessage() {
- return Assertions.fail("foo");
+ return org.assertj.core.api.Assertions.fail("foo");
}
FailWithMessageAndThrowable
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("FailWithMessageAndThrowable")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!JUnitToAssertJRules\$FailWithMessageAndThrowable).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Object testFailWithMessageAndThrowable() {
- 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();
}
AssertThatWithFailMessageStringIsTrue
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatWithFailMessageStringIsTrue")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!JUnitToAssertJRules\$AssertThatWithFailMessageStringIsTrue).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testAssertThatWithFailMessageStringIsTrue() {
- assertTrue(true, "foo");
+ assertThat(true).withFailMessage("foo").isTrue();
}
AssertThatWithFailMessageSupplierIsTrue
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatWithFailMessageSupplierIsTrue")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!JUnitToAssertJRules\$AssertThatWithFailMessageSupplierIsTrue).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testAssertThatWithFailMessageSupplierIsTrue() {
- 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();
}
AssertThatWithFailMessageStringIsFalse
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatWithFailMessageStringIsFalse")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!JUnitToAssertJRules\$AssertThatWithFailMessageStringIsFalse).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testAssertThatWithFailMessageStringIsFalse() {
- assertFalse(true, "foo");
+ assertThat(true).withFailMessage("foo").isFalse();
}
AssertThatWithFailMessageSupplierIsFalse
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatWithFailMessageSupplierIsFalse")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!JUnitToAssertJRules\$AssertThatWithFailMessageSupplierIsFalse).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testAssertThatWithFailMessageSupplierIsFalse() {
- 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();
}
AssertThatWithFailMessageStringIsNull
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatWithFailMessageStringIsNull")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!JUnitToAssertJRules\$AssertThatWithFailMessageStringIsNull).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testAssertThatWithFailMessageStringIsNull() {
- assertNull(new Object(), "foo");
+ assertThat(new Object()).withFailMessage("foo").isNull();
}
AssertThatWithFailMessageSupplierIsNull
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatWithFailMessageSupplierIsNull")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!JUnitToAssertJRules\$AssertThatWithFailMessageSupplierIsNull).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testAssertThatWithFailMessageSupplierIsNull() {
- 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();
}
AssertThatWithFailMessageStringIsNotNull
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatWithFailMessageStringIsNotNull")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!JUnitToAssertJRules\$AssertThatWithFailMessageStringIsNotNull).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testAssertThatWithFailMessageStringIsNotNull() {
- assertNotNull(new Object(), "foo");
+ assertThat(new Object()).withFailMessage("foo").isNotNull();
}
AssertThatWithFailMessageSupplierIsNotNull
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatWithFailMessageSupplierIsNotNull")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!JUnitToAssertJRules\$AssertThatWithFailMessageSupplierIsNotNull).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testAssertThatWithFailMessageSupplierIsNotNull() {
- 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");
}
AssertThatWithFailMessageStringIsSameAs
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatWithFailMessageStringIsSameAs")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!JUnitToAssertJRules\$AssertThatWithFailMessageStringIsSameAs).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testAssertThatWithFailMessageStringIsSameAs() {
- assertSame("foo", "bar", "baz");
+ assertThat("bar").withFailMessage("baz").isSameAs("foo");
}
AssertThatWithFailMessageSupplierIsSameAs
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatWithFailMessageSupplierIsSameAs")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!JUnitToAssertJRules\$AssertThatWithFailMessageSupplierIsSameAs).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testAssertThatWithFailMessageSupplierIsSameAs() {
- 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");
}
AssertThatWithFailMessageStringIsNotSameAs
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatWithFailMessageStringIsNotSameAs")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!JUnitToAssertJRules\$AssertThatWithFailMessageStringIsNotSameAs).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testAssertThatWithFailMessageStringIsNotSameAs() {
- assertNotSame("foo", "bar", "baz");
+ assertThat("bar").withFailMessage("baz").isNotSameAs("foo");
}
AssertThatWithFailMessageSupplierIsNotSameAs
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatWithFailMessageSupplierIsNotSameAs")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!JUnitToAssertJRules\$AssertThatWithFailMessageSupplierIsNotSameAs).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testAssertThatWithFailMessageSupplierIsNotSameAs() {
- 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, () -> {});
+ assertThatThrownBy(() -> {}).isExactlyInstanceOf(IllegalStateException.class);
}
AssertThatThrownByWithFailMessageStringIsExactlyInstanceOf
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatThrownByWithFailMessageStringIsExactlyInstanceOf")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!JUnitToAssertJRules\$AssertThatThrownByWithFailMessageStringIsExactlyInstanceOf).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testAssertThatThrownByWithFailMessageStringIsExactlyInstanceOf() {
- assertThrowsExactly(IllegalStateException.class, () -> {}, "foo");
+ assertThatThrownBy(() -> {})
+ .withFailMessage("foo")
+ .isExactlyInstanceOf(IllegalStateException.class);
}
AssertThatThrownByWithFailMessageSupplierIsExactlyInstanceOf
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatThrownByWithFailMessageSupplierIsExactlyInstanceOf")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!JUnitToAssertJRules\$AssertThatThrownByWithFailMessageSupplierIsExactlyInstanceOf).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testAssertThatThrownByWithFailMessageSupplierIsExactlyInstanceOf() {
- 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, () -> {});
+ assertThatThrownBy(() -> {}).isInstanceOf(IllegalStateException.class);
}
AssertThatThrownByWithFailMessageStringIsInstanceOf
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatThrownByWithFailMessageStringIsInstanceOf")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!JUnitToAssertJRules\$AssertThatThrownByWithFailMessageStringIsInstanceOf).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testAssertThatThrownByWithFailMessageStringIsInstanceOf() {
- assertThrows(IllegalStateException.class, () -> {}, "foo");
+ assertThatThrownBy(() -> {}).withFailMessage("foo").isInstanceOf(IllegalStateException.class);
}
AssertThatThrownByWithFailMessageSupplierIsInstanceOf
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatThrownByWithFailMessageSupplierIsInstanceOf")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!JUnitToAssertJRules\$AssertThatThrownByWithFailMessageSupplierIsInstanceOf).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testAssertThatThrownByWithFailMessageSupplierIsInstanceOf() {
- 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(() -> {});
- assertDoesNotThrow(() -> toString());
+ assertThatCode(() -> {}).doesNotThrowAnyException();
+ assertThatCode(() -> toString()).doesNotThrowAnyException();
}
AssertThatCodeWithFailMessageStringDoesNotThrowAnyException
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatCodeWithFailMessageStringDoesNotThrowAnyException")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!JUnitToAssertJRules\$AssertThatCodeWithFailMessageStringDoesNotThrowAnyException).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testAssertThatCodeWithFailMessageStringDoesNotThrowAnyException() {
- assertDoesNotThrow(() -> {}, "foo");
- assertDoesNotThrow(() -> toString(), "bar");
+ assertThatCode(() -> {}).withFailMessage("foo").doesNotThrowAnyException();
+ assertThatCode(() -> toString()).withFailMessage("bar").doesNotThrowAnyException();
}
AssertThatCodeWithFailMessageSupplierDoesNotThrowAnyException
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatCodeWithFailMessageSupplierDoesNotThrowAnyException")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!JUnitToAssertJRules\$AssertThatCodeWithFailMessageSupplierDoesNotThrowAnyException).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testAssertThatCodeWithFailMessageSupplierDoesNotThrowAnyException() {
- assertDoesNotThrow(() -> {}, () -> "foo");
- assertDoesNotThrow(() -> toString(), () -> "bar");
+ assertThatCode(() -> {}).withFailMessage(() -> "foo").doesNotThrowAnyException();
+ 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);
}
AssertThatWithFailMessageStringIsInstanceOf
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatWithFailMessageStringIsInstanceOf")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!JUnitToAssertJRules\$AssertThatWithFailMessageStringIsInstanceOf).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testAssertThatWithFailMessageStringIsInstanceOf() {
- assertInstanceOf(Object.class, new Object(), "foo");
+ assertThat(new Object()).withFailMessage("foo").isInstanceOf(Object.class);
}
AssertThatWithFailMessageSupplierIsInstanceOf
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatWithFailMessageSupplierIsInstanceOf")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!JUnitToAssertJRules\$AssertThatWithFailMessageSupplierIsInstanceOf).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testAssertThatWithFailMessageSupplierIsInstanceOf() {
- assertInstanceOf(Object.class, new Object(), () -> "foo");
+ assertThat(new Object()).withFailMessage(() -> "foo").isInstanceOf(Object.class);
}