// Path: src/main/java/org/junit/runner/JUnitCore.java
// public class JUnitCore {
//     private final RunNotifier notifier = new RunNotifier();
// 
//     /**
//      * Run the tests contained in the classes named in the <code>args</code>.
//      * If all tests run successfully, exit with a status of 0. Otherwise exit with a status of 1.
//      * Write feedback while tests are running and write
//      * stack traces for all failed tests after the tests all complete.
//      *
//      * @param args names of classes in which to find tests to run
//      */
//     public static void main(String... args) {
//         Result result = new JUnitCore().runMain(new RealSystem(), args);
//         System.exit(result.wasSuccessful() ? 0 : 1);
//     }
// 
//     /**
//      * Run the tests contained in <code>classes</code>. Write feedback while the tests
//      * are running and write stack traces for all failed tests after all tests complete. This is
//      * similar to {@link #main(String[])}, but intended to be used programmatically.
//      *
//      * @param classes Classes in which to find tests
//      * @return a {@link Result} describing the details of the test run and the failed tests.
//      */
//     public static Result runClasses(Class<?>... classes) {
//         return runClasses(defaultComputer(), classes);
//     }
// 
//     /**
//      * Run the tests contained in <code>classes</code>. Write feedback while the tests
//      * are running and write stack traces for all failed tests after all tests complete. This is
//      * similar to {@link #main(String[])}, but intended to be used programmatically.
//      *
//      * @param computer Helps construct Runners from classes
//      * @param classes  Classes in which to find tests
//      * @return a {@link Result} describing the details of the test run and the failed tests.
//      */
//     public static Result runClasses(Computer computer, Class<?>... classes) {
//         return new JUnitCore().run(computer, classes);
//     }
// 
//     /**
//      * @param system system to run with
//      * @param args from main()
//      */
//     Result runMain(JUnitSystem system, String... args) {
//         system.out().println("JUnit version " + Version.id());
// 
//         JUnitCommandLineParseResult jUnitCommandLineParseResult = JUnitCommandLineParseResult.parse(args);
// 
//         RunListener listener = new TextListener(system);
//         addListener(listener);
// 
//         return run(jUnitCommandLineParseResult.createRequest(defaultComputer()));
//     }
// 
//     /**
//      * @return the version number of this release
//      */
//     public String getVersion() {
//         return Version.id();
//     }
// 
//     /**
//      * Run all the tests in <code>classes</code>.
//      *
//      * @param classes the classes containing tests
//      * @return a {@link Result} describing the details of the test run and the failed tests.
//      */
//     public Result run(Class<?>... classes) {
//         return run(defaultComputer(), classes);
//     }
// 
//     /**
//      * Run all the tests in <code>classes</code>.
//      *
//      * @param computer Helps construct Runners from classes
//      * @param classes the classes containing tests
//      * @return a {@link Result} describing the details of the test run and the failed tests.
//      */
//     public Result run(Computer computer, Class<?>... classes) {
//         return run(Request.classes(computer, classes));
//     }
// 
//     /**
//      * Run all the tests contained in <code>request</code>.
//      *
//      * @param request the request describing tests
//      * @return a {@link Result} describing the details of the test run and the failed tests.
//      */
//     public Result run(Request request) {
//         return run(request.getRunner());
//     }
// 
//     /**
//      * Run all the tests contained in JUnit 3.8.x <code>test</code>. Here for backward compatibility.
//      *
//      * @param test the old-style test
//      * @return a {@link Result} describing the details of the test run and the failed tests.
//      */
//     public Result run(junit.framework.Test test) {
//         return run(new JUnit38ClassRunner(test));
//     }
// 
//     /**
//      * Do not use. Testing purposes only.
//      */
//     public Result run(Runner runner) {
//         Result result = new Result();
//         RunListener listener = result.createListener();
//         notifier.addFirstListener(listener);
//         try {
//             notifier.fireTestRunStarted(runner.getDescription());
//             runner.run(notifier);
//             notifier.fireTestRunFinished(result);
//         } finally {
//             removeListener(listener);
//         }
//         return result;
//     }
// 
//     /**
//      * Add a listener to be notified as the tests run.
//      *
//      * @param listener the listener to add
//      * @see org.junit.runner.notification.RunListener
//      */
//     public void addListener(RunListener listener) {
//         notifier.addListener(listener);
//     }
// 
//     /**
//      * Remove a listener.
//      *
//      * @param listener the listener to remove
//      */
//     public void removeListener(RunListener listener) {
//         notifier.removeListener(listener);
//     }
// 
//     static Computer defaultComputer() {
//         return new Computer();
//     }
// }


import static org.hamcrest.CoreMatchers.allOf;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.experimental.results.PrintableResult.testResult;
import static org.junit.experimental.results.ResultMatchers.isSuccessful;
import java.util.Collection;
import java.util.HashSet;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExternalResource;
import org.junit.rules.TestRule;
import org.junit.runner.Description;
import org.junit.runner.JUnitCore;
import org.junit.runner.Result;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
        assertEquals(2, result.getFailureCount());
    }

    public static class RunAllAfterClasses {
        @Before
        public void good() {
        }

        @BeforeClass
        public static void bad() {
            throw new Error();
        }

        @Test
        public void empty() {
        }

        @AfterClass
        public static void one() {
            log += "one";
        }

        @AfterClass
        public static void two() {
            log += "two";
        }
    }

    public void testRunAllAfterClasses() {
        log = "";
// Path: src/main/java/org/junit/runner/JUnitCore.java
// public class JUnitCore {
//     private final RunNotifier notifier = new RunNotifier();
// 
//     /**
//      * Run the tests contained in the classes named in the <code>args</code>.
//      * If all tests run successfully, exit with a status of 0. Otherwise exit with a status of 1.
//      * Write feedback while tests are running and write
//      * stack traces for all failed tests after the tests all complete.
//      *
//      * @param args names of classes in which to find tests to run
//      */
//     public static void main(String... args) {
//         Result result = new JUnitCore().runMain(new RealSystem(), args);
//         System.exit(result.wasSuccessful() ? 0 : 1);
//     }
// 
//     /**
//      * Run the tests contained in <code>classes</code>. Write feedback while the tests
//      * are running and write stack traces for all failed tests after all tests complete. This is
//      * similar to {@link #main(String[])}, but intended to be used programmatically.
//      *
//      * @param classes Classes in which to find tests
//      * @return a {@link Result} describing the details of the test run and the failed tests.
//      */
//     public static Result runClasses(Class<?>... classes) {
//         return runClasses(defaultComputer(), classes);
//     }
// 
//     /**
//      * Run the tests contained in <code>classes</code>. Write feedback while the tests
//      * are running and write stack traces for all failed tests after all tests complete. This is
//      * similar to {@link #main(String[])}, but intended to be used programmatically.
//      *
//      * @param computer Helps construct Runners from classes
//      * @param classes  Classes in which to find tests
//      * @return a {@link Result} describing the details of the test run and the failed tests.
//      */
//     public static Result runClasses(Computer computer, Class<?>... classes) {
//         return new JUnitCore().run(computer, classes);
//     }
// 
//     /**
//      * @param system system to run with
//      * @param args from main()
//      */
//     Result runMain(JUnitSystem system, String... args) {
//         system.out().println("JUnit version " + Version.id());
// 
//         JUnitCommandLineParseResult jUnitCommandLineParseResult = JUnitCommandLineParseResult.parse(args);
// 
//         RunListener listener = new TextListener(system);
//         addListener(listener);
// 
//         return run(jUnitCommandLineParseResult.createRequest(defaultComputer()));
//     }
// 
//     /**
//      * @return the version number of this release
//      */
//     public String getVersion() {
//         return Version.id();
//     }
// 
//     /**
//      * Run all the tests in <code>classes</code>.
//      *
//      * @param classes the classes containing tests
//      * @return a {@link Result} describing the details of the test run and the failed tests.
//      */
//     public Result run(Class<?>... classes) {
//         return run(defaultComputer(), classes);
//     }
// 
//     /**
//      * Run all the tests in <code>classes</code>.
//      *
//      * @param computer Helps construct Runners from classes
//      * @param classes the classes containing tests
//      * @return a {@link Result} describing the details of the test run and the failed tests.
//      */
//     public Result run(Computer computer, Class<?>... classes) {
//         return run(Request.classes(computer, classes));
//     }
// 
//     /**
//      * Run all the tests contained in <code>request</code>.
//      *
//      * @param request the request describing tests
//      * @return a {@link Result} describing the details of the test run and the failed tests.
//      */
//     public Result run(Request request) {
//         return run(request.getRunner());
//     }
// 
//     /**
//      * Run all the tests contained in JUnit 3.8.x <code>test</code>. Here for backward compatibility.
//      *
//      * @param test the old-style test
//      * @return a {@link Result} describing the details of the test run and the failed tests.
//      */
//     public Result run(junit.framework.Test test) {
//         return run(new JUnit38ClassRunner(test));
//     }
// 
//     /**
//      * Do not use. Testing purposes only.
//      */
//     public Result run(Runner runner) {
//         Result result = new Result();
//         RunListener listener = result.createListener();
//         notifier.addFirstListener(listener);
//         try {
//             notifier.fireTestRunStarted(runner.getDescription());
//             runner.run(notifier);
//             notifier.fireTestRunFinished(result);
//         } finally {
//             removeListener(listener);
//         }
//         return result;
//     }
// 
//     /**
//      * Add a listener to be notified as the tests run.
//      *
//      * @param listener the listener to add
//      * @see org.junit.runner.notification.RunListener
//      */
//     public void addListener(RunListener listener) {
//         notifier.addListener(listener);
//     }
// 
//     /**
//      * Remove a listener.
//      *
//      * @param listener the listener to remove
//      */
//     public void removeListener(RunListener listener) {
//         notifier.removeListener(listener);
//     }
// 
//     static Computer defaultComputer() {
//         return new Computer();
//     }
// }


// Path: src/test/java/org/junit/tests/running/methods/AnnotationTest.java
import static org.hamcrest.CoreMatchers.allOf;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.experimental.results.PrintableResult.testResult;
import static org.junit.experimental.results.ResultMatchers.isSuccessful;
import java.util.Collection;
import java.util.HashSet;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExternalResource;
import org.junit.rules.TestRule;
import org.junit.runner.Description;
import org.junit.runner.JUnitCore;
import org.junit.runner.Result;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

        assertEquals(2, result.getFailureCount());
    }

    public static class RunAllAfterClasses {
        @Before
        public void good() {
        }

        @BeforeClass
        public static void bad() {
            throw new Error();
        }

        @Test
        public void empty() {
        }

        @AfterClass
        public static void one() {
            log += "one";
        }

        @AfterClass
        public static void two() {
            log += "two";
        }
    }

    public void testRunAllAfterClasses() {
        log = "";
        JUnitCore core = new JUnitCore();