Skip to content

Commit

Permalink
Fixes github#98: assumptions with expected exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
dsaff committed May 4, 2010
1 parent c077f83 commit ab51452
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
5 changes: 4 additions & 1 deletion acknowledgements.txt
Expand Up @@ -58,4 +58,7 @@
Kristian Rosenvold: Submitted a patch (github#16) that improves thread-safety of
result counting
2010 Feb 08
Paul Holser: Submitted additional test for TestName rule.
Paul Holser: Submitted additional test for TestName rule.

2010 May 03
jonas22@github: Found bug (github#98) with assumptions and expected exceptions.
5 changes: 5 additions & 0 deletions doc/ReleaseNotes4.9.txt
@@ -0,0 +1,5 @@
## Summary of Changes in version 4.9 ##

### Bug fixes ###

- github#98: assumeTrue() does not work with expected exceptions
Expand Up @@ -3,6 +3,7 @@
*/
package org.junit.internal.runners.statements;

import org.junit.internal.AssumptionViolatedException;
import org.junit.runners.model.Statement;

public class ExpectException extends Statement {
Expand All @@ -20,6 +21,8 @@ public void evaluate() throws Exception {
try {
fNext.evaluate();
complete = true;
} catch (AssumptionViolatedException e) {
throw e;
} catch (Throwable e) {
if (!fExpected.isAssignableFrom(e.getClass())) {
String message= "Unexpected exception, expected<"
Expand Down
Expand Up @@ -169,4 +169,9 @@ public AssumptionFailureInConstructor() {
@Test public void failingAssumptionInConstructorIgnoresClass() {
assertThat(testResult(AssumptionFailureInConstructor.class), isSuccessful());
}

@Test(expected = IllegalArgumentException.class)
public void assumeWithExpectedException() {
assumeTrue(false);
}
}

0 comments on commit ab51452

Please sign in to comment.