-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Made ExpectedException.isAnyExceptionExpected public #1443
Made ExpectedException.isAnyExceptionExpected public #1443
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While I can't think of any problems, I think any user of JUnit 4.13 that uses Java 8 should use expectThrows()
or assertThrows()
instead of ExpectExceptoon
/** | ||
* Check if any Exception is expected. | ||
*/ | ||
public boolean isAnyExceptionExpected() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's make this final
@@ -245,6 +245,13 @@ public ExpectedException expectCause(Matcher<?> expectedCause) { | |||
return this; | |||
} | |||
|
|||
/** | |||
* Check if any Exception is expected. | |||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add @since 4.13
Is there any harm in making this method public?
I have a base class for our test classes that has both an ExpectedException rule and a Verifier rule. The problem is that I don't want to run the Verifier if any exception is expected. So this is my current solution: