AssertJThrowingCallableRules
SUGGESTION
Simplification
Suppression
Disable all rules by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJThrowingCallableRules\$).*as compiler argument.
Table of contents
- AssertThatThrownByIsInstanceOf
- AssertThatThrownByIllegalArgumentException
- AssertThatThrownByIllegalArgumentExceptionHasMessage
- AssertThatThrownByIllegalArgumentExceptionRootCauseHasMessage
- AssertThatThrownByIllegalArgumentExceptionHasMessageParameters
- AssertThatThrownByIllegalArgumentExceptionHasMessageStartingWith
- AssertThatThrownByIllegalArgumentExceptionHasMessageContaining
- AssertThatThrownByIllegalArgumentExceptionHasMessageNotContainingAny
- AssertThatThrownByIllegalStateException
- AssertThatThrownByIllegalStateExceptionHasMessage
- AssertThatThrownByIllegalStateExceptionRootCauseHasMessage
- AssertThatThrownByIllegalStateExceptionHasMessageParameters
- AssertThatThrownByIllegalStateExceptionHasMessageStartingWith
- AssertThatThrownByIllegalStateExceptionHasMessageContaining
- AssertThatThrownByIllegalStateExceptionHasMessageNotContaining
- AssertThatThrownByNullPointerException
- AssertThatThrownByNullPointerExceptionHasMessage
- AssertThatThrownByNullPointerExceptionRootCauseHasMessage
- AssertThatThrownByNullPointerExceptionHasMessageParameters
- AssertThatThrownByNullPointerExceptionHasMessageStartingWith
- AssertThatThrownByNullPointerExceptionHasMessageContaining
- AssertThatThrownByNullPointerExceptionHasMessageNotContaining
- AssertThatThrownByIOException
- AssertThatThrownByIOExceptionHasMessage
- AssertThatThrownByIOExceptionRootCauseHasMessage
- AssertThatThrownByIOExceptionHasMessageParameters
- AssertThatThrownByIOExceptionHasMessageStartingWith
- AssertThatThrownByIOExceptionHasMessageContaining
- AssertThatThrownByIOExceptionHasMessageNotContaining
- AssertThatThrownByAsInstanceOfThrowable
- AssertThatThrownByHasMessage
- AssertThatThrownByRootCauseHasMessage
- AssertThatThrownByHasMessageParameters
- AssertThatThrownByHasMessageStartingWith
- AssertThatThrownByHasMessageContaining
- AssertThatThrownByHasMessageNotContaining
- AbstractThrowableAssertHasMessage
- AbstractThrowableAssertWithFailMessage
- AbstractThrowableAssertCauseIsSameAs
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=^(?!AssertJThrowingCallableRules\$AssertThatThrownByIsInstanceOf).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testAssertThatThrownByIsInstanceOf() {
- assertThatThrownBy(() -> {}).asInstanceOf(throwable(IllegalArgumentException.class));
- assertThatThrownBy(() -> {}).asInstanceOf(type(IllegalArgumentException.class));
+ assertThatThrownBy(() -> {}).isInstanceOf(IllegalArgumentException.class);
+ assertThatThrownBy(() -> {}).isInstanceOf(IllegalArgumentException.class);
}AssertThatThrownByIllegalArgumentException
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatThrownByIllegalArgumentException")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJThrowingCallableRules\$AssertThatThrownByIllegalArgumentException).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractObjectAssert<?, ?> testAssertThatThrownByIllegalArgumentException() {
- return assertThatIllegalArgumentException().isThrownBy(() -> {});
+ return assertThatThrownBy(() -> {}).isInstanceOf(IllegalArgumentException.class);
}AssertThatThrownByIllegalArgumentExceptionHasMessage
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatThrownByIllegalArgumentExceptionHasMessage")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJThrowingCallableRules\$AssertThatThrownByIllegalArgumentExceptionHasMessage).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractObjectAssert<?, ?> testAssertThatThrownByIllegalArgumentExceptionHasMessage() {
- return assertThatIllegalArgumentException().isThrownBy(() -> {}).withMessage("foo");
+ return assertThatThrownBy(() -> {})
+ .isInstanceOf(IllegalArgumentException.class)
+ .hasMessage("foo");
}AssertThatThrownByIllegalArgumentExceptionRootCauseHasMessage
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatThrownByIllegalArgumentExceptionRootCauseHasMessage")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJThrowingCallableRules\$AssertThatThrownByIllegalArgumentExceptionRootCauseHasMessage).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractObjectAssert<?, ?> testAssertThatThrownByIllegalArgumentExceptionRootCauseHasMessage() {
- return assertThatIllegalArgumentException()
- .isThrownBy(() -> {})
- .havingRootCause()
- .withMessage("foo");
+ return assertThatThrownBy(() -> {})
+ .isInstanceOf(IllegalArgumentException.class)
+ .rootCause()
+ .hasMessage("foo");
}AssertThatThrownByIllegalArgumentExceptionHasMessageParameters
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatThrownByIllegalArgumentExceptionHasMessageParameters")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJThrowingCallableRules\$AssertThatThrownByIllegalArgumentExceptionHasMessageParameters).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractObjectAssert<?, ?> testAssertThatThrownByIllegalArgumentExceptionHasMessageParameters() {
- return assertThatIllegalArgumentException().isThrownBy(() -> {}).withMessage("foo %s", "bar");
+ return assertThatThrownBy(() -> {})
+ .isInstanceOf(IllegalArgumentException.class)
+ .hasMessage("foo %s", "bar");
}AssertThatThrownByIllegalArgumentExceptionHasMessageStartingWith
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatThrownByIllegalArgumentExceptionHasMessageStartingWith")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJThrowingCallableRules\$AssertThatThrownByIllegalArgumentExceptionHasMessageStartingWith).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractObjectAssert<?, ?>
testAssertThatThrownByIllegalArgumentExceptionHasMessageStartingWith() {
- return assertThatIllegalArgumentException().isThrownBy(() -> {}).withMessageStartingWith("foo");
+ return assertThatThrownBy(() -> {})
+ .isInstanceOf(IllegalArgumentException.class)
+ .hasMessageStartingWith("foo");
}AssertThatThrownByIllegalArgumentExceptionHasMessageContaining
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatThrownByIllegalArgumentExceptionHasMessageContaining")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJThrowingCallableRules\$AssertThatThrownByIllegalArgumentExceptionHasMessageContaining).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractObjectAssert<?, ?> testAssertThatThrownByIllegalArgumentExceptionHasMessageContaining() {
- return assertThatIllegalArgumentException().isThrownBy(() -> {}).withMessageContaining("foo");
+ return assertThatThrownBy(() -> {})
+ .isInstanceOf(IllegalArgumentException.class)
+ .hasMessageContaining("foo");
}AssertThatThrownByIllegalArgumentExceptionHasMessageNotContainingAny
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatThrownByIllegalArgumentExceptionHasMessageNotContainingAny")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJThrowingCallableRules\$AssertThatThrownByIllegalArgumentExceptionHasMessageNotContainingAny).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractObjectAssert<?, ?>
testAssertThatThrownByIllegalArgumentExceptionHasMessageNotContainingAny() {
- return assertThatIllegalArgumentException()
- .isThrownBy(() -> {})
- .withMessageNotContainingAny("foo", "bar");
+ return assertThatThrownBy(() -> {})
+ .isInstanceOf(IllegalArgumentException.class)
+ .hasMessageNotContainingAny("foo", "bar");
}AssertThatThrownByIllegalStateException
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatThrownByIllegalStateException")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJThrowingCallableRules\$AssertThatThrownByIllegalStateException).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractObjectAssert<?, ?> testAssertThatThrownByIllegalStateException() {
- return assertThatIllegalStateException().isThrownBy(() -> {});
+ return assertThatThrownBy(() -> {}).isInstanceOf(IllegalStateException.class);
}AssertThatThrownByIllegalStateExceptionHasMessage
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatThrownByIllegalStateExceptionHasMessage")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJThrowingCallableRules\$AssertThatThrownByIllegalStateExceptionHasMessage).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractObjectAssert<?, ?> testAssertThatThrownByIllegalStateExceptionHasMessage() {
- return assertThatIllegalStateException().isThrownBy(() -> {}).withMessage("foo");
+ return assertThatThrownBy(() -> {}).isInstanceOf(IllegalStateException.class).hasMessage("foo");
}AssertThatThrownByIllegalStateExceptionRootCauseHasMessage
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatThrownByIllegalStateExceptionRootCauseHasMessage")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJThrowingCallableRules\$AssertThatThrownByIllegalStateExceptionRootCauseHasMessage).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractObjectAssert<?, ?> testAssertThatThrownByIllegalStateExceptionRootCauseHasMessage() {
- return assertThatIllegalStateException()
- .isThrownBy(() -> {})
- .havingRootCause()
- .withMessage("foo");
+ return assertThatThrownBy(() -> {})
+ .isInstanceOf(IllegalStateException.class)
+ .rootCause()
+ .hasMessage("foo");
}AssertThatThrownByIllegalStateExceptionHasMessageParameters
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatThrownByIllegalStateExceptionHasMessageParameters")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJThrowingCallableRules\$AssertThatThrownByIllegalStateExceptionHasMessageParameters).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractObjectAssert<?, ?> testAssertThatThrownByIllegalStateExceptionHasMessageParameters() {
- return assertThatIllegalStateException().isThrownBy(() -> {}).withMessage("foo %s", "bar");
+ return assertThatThrownBy(() -> {})
+ .isInstanceOf(IllegalStateException.class)
+ .hasMessage("foo %s", "bar");
}AssertThatThrownByIllegalStateExceptionHasMessageStartingWith
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatThrownByIllegalStateExceptionHasMessageStartingWith")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJThrowingCallableRules\$AssertThatThrownByIllegalStateExceptionHasMessageStartingWith).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractObjectAssert<?, ?> testAssertThatThrownByIllegalStateExceptionHasMessageStartingWith() {
- return assertThatIllegalStateException().isThrownBy(() -> {}).withMessageStartingWith("foo");
+ return assertThatThrownBy(() -> {})
+ .isInstanceOf(IllegalStateException.class)
+ .hasMessageStartingWith("foo");
}AssertThatThrownByIllegalStateExceptionHasMessageContaining
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatThrownByIllegalStateExceptionHasMessageContaining")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJThrowingCallableRules\$AssertThatThrownByIllegalStateExceptionHasMessageContaining).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractObjectAssert<?, ?> testAssertThatThrownByIllegalStateExceptionHasMessageContaining() {
- return assertThatIllegalStateException().isThrownBy(() -> {}).withMessageContaining("foo");
+ return assertThatThrownBy(() -> {})
+ .isInstanceOf(IllegalStateException.class)
+ .hasMessageContaining("foo");
}AssertThatThrownByIllegalStateExceptionHasMessageNotContaining
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatThrownByIllegalStateExceptionHasMessageNotContaining")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJThrowingCallableRules\$AssertThatThrownByIllegalStateExceptionHasMessageNotContaining).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractObjectAssert<?, ?> testAssertThatThrownByIllegalStateExceptionHasMessageNotContaining() {
- return assertThatIllegalStateException().isThrownBy(() -> {}).withMessageNotContaining("foo");
+ return assertThatThrownBy(() -> {})
+ .isInstanceOf(IllegalStateException.class)
+ .hasMessageNotContaining("foo");
}AssertThatThrownByNullPointerException
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatThrownByNullPointerException")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJThrowingCallableRules\$AssertThatThrownByNullPointerException).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractObjectAssert<?, ?> testAssertThatThrownByNullPointerException() {
- return assertThatNullPointerException().isThrownBy(() -> {});
+ return assertThatThrownBy(() -> {}).isInstanceOf(NullPointerException.class);
}AssertThatThrownByNullPointerExceptionHasMessage
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatThrownByNullPointerExceptionHasMessage")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJThrowingCallableRules\$AssertThatThrownByNullPointerExceptionHasMessage).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractObjectAssert<?, ?> testAssertThatThrownByNullPointerExceptionHasMessage() {
- return assertThatNullPointerException().isThrownBy(() -> {}).withMessage("foo");
+ return assertThatThrownBy(() -> {}).isInstanceOf(NullPointerException.class).hasMessage("foo");
}AssertThatThrownByNullPointerExceptionRootCauseHasMessage
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatThrownByNullPointerExceptionRootCauseHasMessage")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJThrowingCallableRules\$AssertThatThrownByNullPointerExceptionRootCauseHasMessage).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractObjectAssert<?, ?> testAssertThatThrownByNullPointerExceptionRootCauseHasMessage() {
- return assertThatNullPointerException()
- .isThrownBy(() -> {})
- .havingRootCause()
- .withMessage("foo");
+ return assertThatThrownBy(() -> {})
+ .isInstanceOf(NullPointerException.class)
+ .rootCause()
+ .hasMessage("foo");
}AssertThatThrownByNullPointerExceptionHasMessageParameters
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatThrownByNullPointerExceptionHasMessageParameters")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJThrowingCallableRules\$AssertThatThrownByNullPointerExceptionHasMessageParameters).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractObjectAssert<?, ?> testAssertThatThrownByNullPointerExceptionHasMessageParameters() {
- return assertThatNullPointerException().isThrownBy(() -> {}).withMessage("foo %s", "bar");
+ return assertThatThrownBy(() -> {})
+ .isInstanceOf(NullPointerException.class)
+ .hasMessage("foo %s", "bar");
}AssertThatThrownByNullPointerExceptionHasMessageStartingWith
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatThrownByNullPointerExceptionHasMessageStartingWith")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJThrowingCallableRules\$AssertThatThrownByNullPointerExceptionHasMessageStartingWith).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractObjectAssert<?, ?> testAssertThatThrownByNullPointerExceptionHasMessageStartingWith() {
- return assertThatNullPointerException().isThrownBy(() -> {}).withMessageStartingWith("foo");
+ return assertThatThrownBy(() -> {})
+ .isInstanceOf(NullPointerException.class)
+ .hasMessageStartingWith("foo");
}AssertThatThrownByNullPointerExceptionHasMessageContaining
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatThrownByNullPointerExceptionHasMessageContaining")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJThrowingCallableRules\$AssertThatThrownByNullPointerExceptionHasMessageContaining).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractObjectAssert<?, ?> testAssertThatThrownByNullPointerExceptionHasMessageContaining() {
- return assertThatNullPointerException().isThrownBy(() -> {}).withMessageContaining("foo");
+ return assertThatThrownBy(() -> {})
+ .isInstanceOf(NullPointerException.class)
+ .hasMessageContaining("foo");
}AssertThatThrownByNullPointerExceptionHasMessageNotContaining
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatThrownByNullPointerExceptionHasMessageNotContaining")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJThrowingCallableRules\$AssertThatThrownByNullPointerExceptionHasMessageNotContaining).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractObjectAssert<?, ?> testAssertThatThrownByNullPointerExceptionHasMessageNotContaining() {
- return assertThatNullPointerException().isThrownBy(() -> {}).withMessageNotContaining("foo");
+ return assertThatThrownBy(() -> {})
+ .isInstanceOf(NullPointerException.class)
+ .hasMessageNotContaining("foo");
}AssertThatThrownByIOException
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatThrownByIOException")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJThrowingCallableRules\$AssertThatThrownByIOException).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractObjectAssert<?, ?> testAssertThatThrownByIOException() {
- return assertThatIOException().isThrownBy(() -> {});
+ return assertThatThrownBy(() -> {}).isInstanceOf(IOException.class);
}AssertThatThrownByIOExceptionHasMessage
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatThrownByIOExceptionHasMessage")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJThrowingCallableRules\$AssertThatThrownByIOExceptionHasMessage).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractObjectAssert<?, ?> testAssertThatThrownByIOExceptionHasMessage() {
- return assertThatIOException().isThrownBy(() -> {}).withMessage("foo");
+ return assertThatThrownBy(() -> {}).isInstanceOf(IOException.class).hasMessage("foo");
}AssertThatThrownByIOExceptionRootCauseHasMessage
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatThrownByIOExceptionRootCauseHasMessage")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJThrowingCallableRules\$AssertThatThrownByIOExceptionRootCauseHasMessage).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractObjectAssert<?, ?> testAssertThatThrownByIOExceptionRootCauseHasMessage() {
- return assertThatIOException().isThrownBy(() -> {}).havingRootCause().withMessage("foo");
+ return assertThatThrownBy(() -> {})
+ .isInstanceOf(IOException.class)
+ .rootCause()
+ .hasMessage("foo");
}AssertThatThrownByIOExceptionHasMessageParameters
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatThrownByIOExceptionHasMessageParameters")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJThrowingCallableRules\$AssertThatThrownByIOExceptionHasMessageParameters).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractObjectAssert<?, ?> testAssertThatThrownByIOExceptionHasMessageParameters() {
- return assertThatIOException().isThrownBy(() -> {}).withMessage("foo %s", "bar");
+ return assertThatThrownBy(() -> {}).isInstanceOf(IOException.class).hasMessage("foo %s", "bar");
}AssertThatThrownByIOExceptionHasMessageStartingWith
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatThrownByIOExceptionHasMessageStartingWith")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJThrowingCallableRules\$AssertThatThrownByIOExceptionHasMessageStartingWith).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractObjectAssert<?, ?> testAssertThatThrownByIOExceptionHasMessageStartingWith() {
- return assertThatIOException().isThrownBy(() -> {}).withMessageStartingWith("foo");
+ return assertThatThrownBy(() -> {})
+ .isInstanceOf(IOException.class)
+ .hasMessageStartingWith("foo");
}AssertThatThrownByIOExceptionHasMessageContaining
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatThrownByIOExceptionHasMessageContaining")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJThrowingCallableRules\$AssertThatThrownByIOExceptionHasMessageContaining).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractObjectAssert<?, ?> testAssertThatThrownByIOExceptionHasMessageContaining() {
- return assertThatIOException().isThrownBy(() -> {}).withMessageContaining("foo");
+ return assertThatThrownBy(() -> {}).isInstanceOf(IOException.class).hasMessageContaining("foo");
}AssertThatThrownByIOExceptionHasMessageNotContaining
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatThrownByIOExceptionHasMessageNotContaining")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJThrowingCallableRules\$AssertThatThrownByIOExceptionHasMessageNotContaining).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractObjectAssert<?, ?> testAssertThatThrownByIOExceptionHasMessageNotContaining() {
- return assertThatIOException().isThrownBy(() -> {}).withMessageNotContaining("foo");
+ return assertThatThrownBy(() -> {})
+ .isInstanceOf(IOException.class)
+ .hasMessageNotContaining("foo");
}AssertThatThrownByAsInstanceOfThrowable
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatThrownByAsInstanceOfThrowable")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJThrowingCallableRules\$AssertThatThrownByAsInstanceOfThrowable).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractObjectAssert<?, ?> testAssertThatThrownByAsInstanceOfThrowable() {
- return assertThatExceptionOfType(IllegalArgumentException.class).isThrownBy(() -> {});
+ return assertThatThrownBy(() -> {}).asInstanceOf(throwable(IllegalArgumentException.class));
}AssertThatThrownByHasMessage
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatThrownByHasMessage")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJThrowingCallableRules\$AssertThatThrownByHasMessage).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractObjectAssert<?, ?> testAssertThatThrownByHasMessage() {
- return assertThatExceptionOfType(IllegalArgumentException.class)
- .isThrownBy(() -> {})
- .withMessage("foo");
+ return assertThatThrownBy(() -> {})
+ .isInstanceOf(IllegalArgumentException.class)
+ .hasMessage("foo");
}AssertThatThrownByRootCauseHasMessage
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatThrownByRootCauseHasMessage")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJThrowingCallableRules\$AssertThatThrownByRootCauseHasMessage).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractObjectAssert<?, ?> testAssertThatThrownByRootCauseHasMessage() {
- return assertThatExceptionOfType(IllegalArgumentException.class)
- .isThrownBy(() -> {})
- .havingRootCause()
- .withMessage("foo");
+ return assertThatThrownBy(() -> {})
+ .isInstanceOf(IllegalArgumentException.class)
+ .rootCause()
+ .hasMessage("foo");
}AssertThatThrownByHasMessageParameters
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatThrownByHasMessageParameters")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJThrowingCallableRules\$AssertThatThrownByHasMessageParameters).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractObjectAssert<?, ?> testAssertThatThrownByHasMessageParameters() {
- return assertThatExceptionOfType(IllegalArgumentException.class)
- .isThrownBy(() -> {})
- .withMessage("foo %s", "bar");
+ return assertThatThrownBy(() -> {})
+ .isInstanceOf(IllegalArgumentException.class)
+ .hasMessage("foo %s", "bar");
}AssertThatThrownByHasMessageStartingWith
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatThrownByHasMessageStartingWith")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJThrowingCallableRules\$AssertThatThrownByHasMessageStartingWith).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractObjectAssert<?, ?> testAssertThatThrownByHasMessageStartingWith() {
- return assertThatExceptionOfType(IllegalArgumentException.class)
- .isThrownBy(() -> {})
- .withMessageStartingWith("foo");
+ return assertThatThrownBy(() -> {})
+ .isInstanceOf(IllegalArgumentException.class)
+ .hasMessageStartingWith("foo");
}AssertThatThrownByHasMessageContaining
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatThrownByHasMessageContaining")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJThrowingCallableRules\$AssertThatThrownByHasMessageContaining).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractObjectAssert<?, ?> testAssertThatThrownByHasMessageContaining() {
- return assertThatExceptionOfType(IllegalArgumentException.class)
- .isThrownBy(() -> {})
- .withMessageContaining("foo");
+ return assertThatThrownBy(() -> {})
+ .isInstanceOf(IllegalArgumentException.class)
+ .hasMessageContaining("foo");
}AssertThatThrownByHasMessageNotContaining
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatThrownByHasMessageNotContaining")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJThrowingCallableRules\$AssertThatThrownByHasMessageNotContaining).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
AbstractObjectAssert<?, ?> testAssertThatThrownByHasMessageNotContaining() {
- return assertThatExceptionOfType(IllegalArgumentException.class)
- .isThrownBy(() -> {})
- .withMessageNotContaining("foo");
+ return assertThatThrownBy(() -> {})
+ .isInstanceOf(IllegalArgumentException.class)
+ .hasMessageNotContaining("foo");
}AbstractThrowableAssertHasMessage
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AbstractThrowableAssertHasMessage")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJThrowingCallableRules\$AbstractThrowableAssertHasMessage).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<AbstractThrowableAssert<?, ? extends Throwable>>
testAbstractThrowableAssertHasMessage() {
return ImmutableSet.of(
assertThatThrownBy(() -> {})
.isInstanceOf(IllegalArgumentException.class)
- .hasMessage(String.format("foo %s", "bar")),
+ .hasMessage("foo %s", "bar"),
assertThatThrownBy(() -> {})
.isInstanceOf(IllegalArgumentException.class)
- .hasMessage(String.format("foo %s %s", "bar", 1)));
+ .hasMessage("foo %s %s", "bar", 1));
}AbstractThrowableAssertWithFailMessage
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AbstractThrowableAssertWithFailMessage")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJThrowingCallableRules\$AbstractThrowableAssertWithFailMessage).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<AbstractThrowableAssert<?, ? extends Throwable>>
testAbstractThrowableAssertWithFailMessage() {
return ImmutableSet.of(
assertThatThrownBy(() -> {})
.isInstanceOf(IllegalArgumentException.class)
- .withFailMessage(String.format("foo %s", "bar")),
+ .withFailMessage("foo %s", "bar"),
assertThatThrownBy(() -> {})
.isInstanceOf(IllegalArgumentException.class)
- .withFailMessage(String.format("foo %s %s", "bar", 1)));
+ .withFailMessage("foo %s %s", "bar", 1));
}AbstractThrowableAssertCauseIsSameAs
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AbstractThrowableAssertCauseIsSameAs")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!AssertJThrowingCallableRules\$AbstractThrowableAssertCauseIsSameAs).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
@SuppressWarnings("deprecation" /* Rule targets deprecated API. */)
AbstractThrowableAssert<?, ? extends Throwable> testAbstractThrowableAssertCauseIsSameAs() {
- return assertThat(new IllegalStateException())
- .hasCauseReference(new IllegalArgumentException());
+ return assertThat(new IllegalStateException()).cause().isSameAs(new IllegalArgumentException());
}