package me.dinowernli.junit;

import java.util.Set;

import org.junit.internal.TextListener;
import org.junit.runner.JUnitCore;
import org.junit.runner.Result;

/**
 * A test runner which scans for types annotated with {@link TestClass} and then delegates to the
 * standard JUnit runner.
 */
public class TestRunner {
  public static void main(String[] args) {
    // First, find all the test classes.
    Set<Class<?>> testClasses = Scanner.create().findTypesAnnotatedWith(TestClass.class);
    System.out.println("Number of test classes detected: " + testClasses.size());
    for (Class<?> testClass : testClasses) {
      System.out.println("Test class: " + testClass.getCanonicalName());
    }
    if (testClasses.isEmpty()) {
      throw new RuntimeException("Found no test classes");
    }

    // Then, execute them using JUnit.
    Class<?>[] classes = testClasses.toArray(new Class<?>[0]);
    JUnitCore junit = new JUnitCore();
    junit.addListener(new TextListener(System.out));
    Result result = junit.run(classes);
    if (result.wasSuccessful()) {
      System.exit(0);
    } else {
      System.exit(1);
    }
  }
}

@@ -1029,19 +1029,27 @@
 s);%0A    
-if 
+System.exit
 (result.
@@ -1067,74 +1067,18 @@
 ul()
-) %7B%0A      System.exit(0);%0A    %7D else %7B%0A      System.exit(1);%0A    %7D
+ ? 0 : 1);
 %0A  %7D

Make runner result ternary.