private RunStatistics runClasses(Class<?>... classes) throws TestSetFailedException {
    HashMap<String, TestSet> classMethodCounts = new HashMap<String, TestSet>();
    final DefaultReporterFactory reporterManagerFactory = createReporterFactory();
    org.junit.runner.notification.RunListener demultiplexingRunListener =
        createRunListener(reporterManagerFactory, classMethodCounts);

    JUnitCore jUnitCore = new JUnitCore();

    jUnitCore.addListener(demultiplexingRunListener);
    Computer computer = new Computer();

    jUnitCore.run(computer, classes);
    reporterManagerFactory.close();
    return reporterManagerFactory.getGlobalRunStatistics();
  }
  private RunStatistics runClasses(
      DefaultReporterFactory reporterManagerFactory,
      org.junit.runner.notification.RunListener demultiplexingRunListener,
      Class<?>... classes)
      throws TestSetFailedException {

    JUnitCore jUnitCore = new JUnitCore();

    jUnitCore.addListener(demultiplexingRunListener);
    Computer computer = new Computer();

    jUnitCore.run(computer, classes);
    return reporterManagerFactory.getGlobalRunStatistics();
  }
 private DefaultReporterFactory createReporterFactory() {
   return DefaultReporterFactory.defaultNoXml();
 }