|
3 | 3 | import java.util.ArrayList;
|
4 | 4 | import java.util.List;
|
5 | 5 |
|
6 |
| -import org.junit.internal.AssumptionViolatedException; |
| 6 | +import org.junit.AssumptionViolatedException; |
7 | 7 | import org.junit.runner.Description;
|
8 | 8 | import org.junit.runners.model.MultipleFailureException;
|
9 | 9 | import org.junit.runners.model.Statement;
|
@@ -54,7 +54,7 @@ public void evaluate() throws Throwable {
|
54 | 54 | try {
|
55 | 55 | base.evaluate();
|
56 | 56 | succeededQuietly(description, errors);
|
57 |
| - } catch (AssumptionViolatedException e) { |
| 57 | + } catch (@SuppressWarnings("deprecation") org.junit.internal.AssumptionViolatedException e) { |
58 | 58 | errors.add(e);
|
59 | 59 | skippedQuietly(e, description, errors);
|
60 | 60 | } catch (Throwable e) {
|
@@ -87,10 +87,16 @@ private void failedQuietly(Throwable e, Description description,
|
87 | 87 | }
|
88 | 88 | }
|
89 | 89 |
|
90 |
| - private void skippedQuietly(AssumptionViolatedException e, Description description, |
| 90 | + @SuppressWarnings("deprecation") |
| 91 | + private void skippedQuietly( |
| 92 | + org.junit.internal.AssumptionViolatedException e, Description description, |
91 | 93 | List<Throwable> errors) {
|
92 | 94 | try {
|
93 |
| - skipped(e, description); |
| 95 | + if (e instanceof AssumptionViolatedException) { |
| 96 | + skipped((AssumptionViolatedException) e, description); |
| 97 | + } else { |
| 98 | + skipped(e, description); |
| 99 | + } |
94 | 100 | } catch (Throwable e1) {
|
95 | 101 | errors.add(e1);
|
96 | 102 | }
|
@@ -129,7 +135,21 @@ protected void failed(Throwable e, Description description) {
|
129 | 135 | /**
|
130 | 136 | * Invoked when a test is skipped due to a failed assumption.
|
131 | 137 | */
|
| 138 | + @SuppressWarnings("deprecation") |
132 | 139 | protected void skipped(AssumptionViolatedException e, Description description) {
|
| 140 | + // For backwards compatibility with JUnit 4.11 and earlier, call the legacy version |
| 141 | + org.junit.internal.AssumptionViolatedException asInternalException = e; |
| 142 | + skipped(asInternalException, description); |
| 143 | + } |
| 144 | + |
| 145 | + /** |
| 146 | + * Invoked when a test is skipped due to a failed assumption. |
| 147 | + * |
| 148 | + * @deprecated use {@link #skipped(AssumptionViolatedException, Description)} |
| 149 | + */ |
| 150 | + @Deprecated |
| 151 | + protected void skipped( |
| 152 | + org.junit.internal.AssumptionViolatedException e, Description description) { |
133 | 153 | }
|
134 | 154 |
|
135 | 155 | /**
|
|
0 commit comments