예제 #1
0
 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);
 }
예제 #2
0
 public static void runTestAndExpect(Test test, int expFailures, boolean checkException) {
   runTestAndExpect(Iterators.singletonIterable(test), expFailures, checkException);
 }
예제 #3
0
 public void testRunsRed() {
   TestResult result = new TestResult();
   new TestRunner(Iterators.singletonIterable(new RunsRed(EXCEPTION))).run(result);
   Assert.isTrue(result.failures().size() == 1, "not red");
 }
예제 #4
0
 public void testRunsGreen() {
   TestResult result = new TestResult();
   new TestRunner(Iterators.singletonIterable(new RunsGreen())).run(result);
   Assert.isTrue(result.failures().size() == 0, "not green");
 }
예제 #5
0
 public String toString() {
   return methodName + "(" + Iterators.join(Iterators.iterate(args), ", ") + ")";
 }