Skip to content
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

Merged
merged 2 commits into from
May 6, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/main/java/org/junit/rules/ExpectedException.java
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,13 @@ public ExpectedException expectCause(Matcher<?> expectedCause) {
return this;
}

/**
* Check if any Exception is expected.
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add @since 4.13

public boolean isAnyExceptionExpected() {
Copy link
Member

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

return matcherBuilder.expectsThrowable();
}

private class ExpectedExceptionStatement extends Statement {
private final Statement next;

Expand Down Expand Up @@ -274,10 +281,6 @@ private void handleException(Throwable e) throws Throwable {
}
}

private boolean isAnyExceptionExpected() {
return matcherBuilder.expectsThrowable();
}

private void failDueToMissingException() throws AssertionError {
fail(missingExceptionMessage());
}
Expand Down