// Path: src/test/java/com/github/havarunner/TestHelper.java
// public static <T> void addHundredTimes(T item, List<T> items) throws InterruptedException {
//     for (int i = 0; i < 100; i++) {
//         Thread.sleep(1); // Sleep to increase chances of context switching
//         items.add(item);
//     }
// }
// 
// Path: src/test/java/com/github/havarunner/TestHelper.java
// public static void assertAllEqual(int expected, List<Integer> integers) {
//     assertTrue(allEqual(expected, integers));
// }
// 
// Path: src/test/java/com/github/havarunner/TestHelper.java
// public static void run(HavaRunner havaRunner, RunNotifier runNotifier) {
//     havaRunner.run(runNotifier);
// }


import com.github.havarunner.ConcurrencyControl;
import com.github.havarunner.HavaRunner;
import com.github.havarunner.TestAndParameters;
import com.github.havarunner.annotation.RunSequentially;
import com.github.havarunner.annotation.Scenarios;
import com.google.common.base.Predicate;
import com.google.common.collect.Collections2;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.runners.Enclosed;
import org.junit.runner.RunWith;
import javax.annotation.Nullable;
import java.util.Collection;
import java.util.List;
import static com.github.havarunner.ConcurrencyControl.semaphore;
import static com.github.havarunner.TestHelper.addHundredTimes;
import static com.github.havarunner.TestHelper.assertAllEqual;
import static com.github.havarunner.TestHelper.run;
import static com.google.common.collect.Collections2.filter;
import static org.junit.Assert.*;
        public void HavaRunner_marks_the_test_to_be_RunSequentially() {
            TestAndParameters test = findByClass(new HavaRunner(SequentialSuite.class).tests(), SuiteMember.class);
            assertTrue(test.runSequentially().isDefined());
            assertEquals("tests in this suite do not thrive in the concurrent world", test.runSequentially().get().because());
        }

        @Test
        public void HavaRunner_lets_the_test_override_the_RunSequentially_spec_of_the_suite() {
            TestAndParameters test = findByClass(
                new HavaRunner(SequentialSuite.class).tests(),
                SuiteMemberOverridingRunSequentially.class
            );
            assertTrue(test.runSequentially().isDefined());
            assertEquals("this suite member has its own reason for sequentiality", test.runSequentially().get().because());
        }

        private TestAndParameters findByClass(Iterable<TestAndParameters> children, final Class clazz) {
            return Iterables.find(children, new Predicate<TestAndParameters>() {
                public boolean apply(TestAndParameters input) {
                    return input.testClass().equals(clazz);
                }
            });
        }
    }

    public static class when_there_is_only_one_test {
        static List<Integer> items = Lists.newArrayList();

        @BeforeClass
        public static void runTest() {
// Path: src/test/java/com/github/havarunner/TestHelper.java
// public static <T> void addHundredTimes(T item, List<T> items) throws InterruptedException {
//     for (int i = 0; i < 100; i++) {
//         Thread.sleep(1); // Sleep to increase chances of context switching
//         items.add(item);
//     }
// }
// 
// Path: src/test/java/com/github/havarunner/TestHelper.java
// public static void assertAllEqual(int expected, List<Integer> integers) {
//     assertTrue(allEqual(expected, integers));
// }
// 
// Path: src/test/java/com/github/havarunner/TestHelper.java
// public static void run(HavaRunner havaRunner, RunNotifier runNotifier) {
//     havaRunner.run(runNotifier);
// }


// Path: src/test/java/com/github/havarunner/sequentiality/RunSequentiallyTestsOfSameInstance.java
import com.github.havarunner.ConcurrencyControl;
import com.github.havarunner.HavaRunner;
import com.github.havarunner.TestAndParameters;
import com.github.havarunner.annotation.RunSequentially;
import com.github.havarunner.annotation.Scenarios;
import com.google.common.base.Predicate;
import com.google.common.collect.Collections2;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.runners.Enclosed;
import org.junit.runner.RunWith;
import javax.annotation.Nullable;
import java.util.Collection;
import java.util.List;
import static com.github.havarunner.ConcurrencyControl.semaphore;
import static com.github.havarunner.TestHelper.addHundredTimes;
import static com.github.havarunner.TestHelper.assertAllEqual;
import static com.github.havarunner.TestHelper.run;
import static com.google.common.collect.Collections2.filter;
import static org.junit.Assert.*;

        public void HavaRunner_marks_the_test_to_be_RunSequentially() {
            TestAndParameters test = findByClass(new HavaRunner(SequentialSuite.class).tests(), SuiteMember.class);
            assertTrue(test.runSequentially().isDefined());
            assertEquals("tests in this suite do not thrive in the concurrent world", test.runSequentially().get().because());
        }

        @Test
        public void HavaRunner_lets_the_test_override_the_RunSequentially_spec_of_the_suite() {
            TestAndParameters test = findByClass(
                new HavaRunner(SequentialSuite.class).tests(),
                SuiteMemberOverridingRunSequentially.class
            );
            assertTrue(test.runSequentially().isDefined());
            assertEquals("this suite member has its own reason for sequentiality", test.runSequentially().get().because());
        }

        private TestAndParameters findByClass(Iterable<TestAndParameters> children, final Class clazz) {
            return Iterables.find(children, new Predicate<TestAndParameters>() {
                public boolean apply(TestAndParameters input) {
                    return input.testClass().equals(clazz);
                }
            });
        }
    }

    public static class when_there_is_only_one_test {
        static List<Integer> items = Lists.newArrayList();

        @BeforeClass
        public static void runTest() {
            run(new HavaRunner(SeqTest.class));