private void assertTestRuns(int... failingIndices) {
   IntByRef counter = new IntByRef();
   TestResult result =
       new TestResult() {
         @Override
         public void testStarted(Test test) {
           super.testStarted(test);
           Assert.isInstanceOf(CountingTest.class, test);
         }
       };
   new TestRunner(Iterators.iterable(new SimpleTestSuite(counter, NUM_TESTS, failingIndices)))
       .run(result);
   Assert.areEqual(NUM_TESTS, result.testCount());
   Assert.areEqual(failingIndices.length, result.failures().size());
   Assert.areEqual(NUM_TESTS + 2, counter.value);
 }
 public static void runTestAndExpect(Test test, int expFailures, boolean checkException) {
   runTestAndExpect(Iterators.singletonIterable(test), expFailures, checkException);
 }
 public void testRunsRed() {
   TestResult result = new TestResult();
   new TestRunner(Iterators.singletonIterable(new RunsRed(EXCEPTION))).run(result);
   Assert.isTrue(result.failures().size() == 1, "not red");
 }
 public void testRunsGreen() {
   TestResult result = new TestResult();
   new TestRunner(Iterators.singletonIterable(new RunsGreen())).run(result);
   Assert.isTrue(result.failures().size() == 0, "not green");
 }
Example #5
0
 public String toString() {
   return methodName + "(" + Iterators.join(Iterators.iterate(args), ", ") + ")";
 }