1 package org.junit.internal.builders;
2 
3 import org.junit.internal.runners.SuiteMethod;
4 import org.junit.runner.Runner;
5 import org.junit.runners.model.RunnerBuilder;
6 
7 public class SuiteMethodBuilder extends RunnerBuilder {
8     @Override
runnerForClass(Class<?> each)9     public Runner runnerForClass(Class<?> each) throws Throwable {
10         if (hasSuiteMethod(each)) {
11             return new SuiteMethod(each);
12         }
13         return null;
14     }
15 
hasSuiteMethod(Class<?> testClass)16     public boolean hasSuiteMethod(Class<?> testClass) {
17         try {
18             testClass.getMethod("suite");
19         } catch (NoSuchMethodException e) {
20             return false;
21         }
22         return true;
23     }
24 }