From b1b86c8455b077531dc5dbca7fe10862ebf04376 Mon Sep 17 00:00:00 2001 From: Jonathan Karlsson Date: Thu, 27 Apr 2017 12:57:28 +0200 Subject: [PATCH 1/2] Made ExpectedExceptio.isAnyExceptionExpected public. --- src/main/java/org/junit/rules/ExpectedException.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/junit/rules/ExpectedException.java b/src/main/java/org/junit/rules/ExpectedException.java index 0f1cb82bd309..67559252bd12 100644 --- a/src/main/java/org/junit/rules/ExpectedException.java +++ b/src/main/java/org/junit/rules/ExpectedException.java @@ -245,6 +245,13 @@ public ExpectedException expectCause(Matcher expectedCause) { return this; } + /** + * Check if any Exception is expected. + */ + public boolean isAnyExceptionExpected() { + return matcherBuilder.expectsThrowable(); + } + private class ExpectedExceptionStatement extends Statement { private final Statement next; @@ -274,10 +281,6 @@ private void handleException(Throwable e) throws Throwable { } } - private boolean isAnyExceptionExpected() { - return matcherBuilder.expectsThrowable(); - } - private void failDueToMissingException() throws AssertionError { fail(missingExceptionMessage()); } From fdfc5110139577fe091863398a1c438112bc9c03 Mon Sep 17 00:00:00 2001 From: Jonathan Karlsson Date: Fri, 28 Apr 2017 09:14:59 +0200 Subject: [PATCH 2/2] Corrected pull request comments --- src/main/java/org/junit/rules/ExpectedException.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/junit/rules/ExpectedException.java b/src/main/java/org/junit/rules/ExpectedException.java index 67559252bd12..3aa09117ff3e 100644 --- a/src/main/java/org/junit/rules/ExpectedException.java +++ b/src/main/java/org/junit/rules/ExpectedException.java @@ -247,8 +247,9 @@ public ExpectedException expectCause(Matcher expectedCause) { /** * Check if any Exception is expected. + * @since 4.13 */ - public boolean isAnyExceptionExpected() { + public final boolean isAnyExceptionExpected() { return matcherBuilder.expectsThrowable(); }