File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed
core/src/main/java/cucumber/runtime
junit/src/main/java/cucumber/runtime/junit Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change 3333 */
3434public class Runtime {
3535
36- private static final String [] PENDING_EXCEPTIONS = {
36+ private static final String [] ASSUMPTION_VIOLATED_EXCEPTIONS = {
3737 "org.junit.AssumptionViolatedException" ,
3838 "org.junit.internal.AssumptionViolatedException"
3939 };
4040
4141 static {
42- Arrays .sort (PENDING_EXCEPTIONS );
42+ Arrays .sort (ASSUMPTION_VIOLATED_EXCEPTIONS );
4343 }
4444
4545 private static final byte ERRORS = 0x1 ;
@@ -236,7 +236,14 @@ public static boolean isPending(Throwable t) {
236236 if (t == null ) {
237237 return false ;
238238 }
239- return t .getClass ().isAnnotationPresent (Pending .class ) || Arrays .binarySearch (PENDING_EXCEPTIONS , t .getClass ().getName ()) >= 0 ;
239+ return t .getClass ().isAnnotationPresent (Pending .class ) || isAssumptionViolated (t );
240+ }
241+
242+ public static boolean isAssumptionViolated (Throwable t ) {
243+ if (t == null ) {
244+ return false ;
245+ }
246+ return Arrays .binarySearch (ASSUMPTION_VIOLATED_EXCEPTIONS , t .getClass ().getName ()) >= 0 ;
240247 }
241248
242249 private void addStepToCounterAndResult (Result result ) {
Original file line number Diff line number Diff line change 1313import org .junit .runner .notification .RunNotifier ;
1414import org .junit .runners .model .MultipleFailureException ;
1515
16+ import static cucumber .runtime .Runtime .isAssumptionViolated ;
1617import static cucumber .runtime .Runtime .isPending ;
1718
1819public class JUnitReporter {
@@ -202,7 +203,7 @@ static class EachTestNotifier implements TestNotifier {
202203 public void addFailure (Throwable targetException ) {
203204 if (targetException instanceof MultipleFailureException ) {
204205 addMultipleFailureException ((MultipleFailureException ) targetException );
205- } else if (isPending (targetException )) {
206+ } else if (isAssumptionViolated (targetException )) {
206207 addFailedAssumption (targetException );
207208 } else {
208209 notifier .fireTestFailure (new Failure (description , targetException ));
You can’t perform that action at this time.
0 commit comments