@@ -0,0 +1,3170 @@
+// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.%0Apackage com.intellij.testFramework;%0A%0Aimport junit.framework.Test;%0Aimport org.junit.Assume;%0Aimport org.junit.AssumptionViolatedException;%0Aimport org.junit.internal.runners.JUnit38ClassRunner;%0Aimport org.junit.runner.Description;%0Aimport org.junit.runner.Result;%0Aimport org.junit.runner.notification.Failure;%0Aimport org.junit.runner.notification.RunListener;%0Aimport org.junit.runner.notification.RunNotifier;%0Aimport org.junit.runner.notification.StoppedByUserException;%0A%0A/**%0A * JUnit 3 tests don't support %22ignore%22 state.%0A * We extends the default junit 3 behaviour adding %7B@link Assume%7D support for such test.%0A * %0A * After adding the runner using @RunWith(JSUnit38AssumeSupportRunner.class) for the test class %0A * you can use %7B@link Assume%7D to control test behaviour depends on some external conditions.%0A * %0A * @apiNote it is required only for JUnit3 tests (e.g. void testMyTestName()) %0A * if you use JUnit4 tests style (@Test void testMyTestName()) you don't need it %0A */%0Apublic class JSUnit38AssumeSupportRunner extends JUnit38ClassRunner %7B%0A  %0A  @SuppressWarnings(%22unused%22) //used by reflection%0A  public JSUnit38AssumeSupportRunner(Class%3C?%3E klass) %7B%0A    super(klass);%0A  %7D%0A%0A  @SuppressWarnings(%22unused%22) //used by reflection%0A  public JSUnit38AssumeSupportRunner(Test test) %7B%0A    super(test);%0A  %7D%0A%0A  @Override%0A  public void run(RunNotifier originalNotifier) %7B%0A    RunNotifier wrapperNotifier = new RunNotifier() %7B%0A%0A      @Override%0A      public void addListener(RunListener listener) %7B%0A        originalNotifier.addListener(listener);%0A      %7D%0A%0A      @Override%0A      public void removeListener(RunListener listener) %7B%0A        originalNotifier.removeListener(listener);%0A      %7D%0A%0A      @Override%0A      public void fireTestRunStarted(Description description) %7B%0A        originalNotifier.fireTestRunStarted(description);%0A      %7D%0A%0A      @Override%0A      public void fireTestRunFinished(Result result) %7B%0A        originalNotifier.fireTestRunFinished(result);%0A      %7D%0A%0A      @Override%0A      public void fireTestStarted(Description description) throws StoppedByUserException %7B%0A        originalNotifier.fireTestStarted(description);%0A      %7D%0A%0A      @Override%0A      public void fireTestFailure(Failure failure) %7B%0A        if (failure.getException() instanceof AssumptionViolatedException) %7B%0A          originalNotifier.fireTestAssumptionFailed(failure);%0A          return;%0A        %7D%0A        originalNotifier.fireTestFailure(failure);%0A      %7D%0A%0A      @Override%0A      public void fireTestAssumptionFailed(Failure failure) %7B%0A        originalNotifier.fireTestAssumptionFailed(failure);%0A      %7D%0A%0A      @Override%0A      public void fireTestIgnored(Description description) %7B%0A        originalNotifier.fireTestIgnored(description);%0A      %7D%0A%0A      @Override%0A      public void fireTestFinished(Description description) %7B%0A        originalNotifier.fireTestFinished(description);%0A      %7D%0A%0A      @Override%0A      public void pleaseStop() %7B%0A        originalNotifier.pleaseStop();%0A        super.pleaseStop();%0A      %7D%0A    %7D;%0A    %0A    super.run(wrapperNotifier);%0A  %7D%0A  %0A%7D%0A

move generic class to the platform test framework