1b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabotpackage org.junit.experimental.runners; 2b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot 3b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabotimport org.junit.runners.Suite; 4b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabotimport org.junit.runners.model.RunnerBuilder; 5b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot 6b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot 7b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot/** 8b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot * If you put tests in inner classes, Ant, for example, won't find them. By running the outer class 9b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot * with Enclosed, the tests in the inner classes will be run. You might put tests in inner classes 10b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot * to group them for convenience or to share constants. 11b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot * 12b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot * So, for example: 13b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot * <pre> 14b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot * \@RunWith(Enclosed.class) 15b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot * public class ListTests { 16b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot * ...useful shared stuff... 17b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot * public static class OneKindOfListTest {...} 18b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot * public static class AnotherKind {...} 19b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot * } 20b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot * </pre> 21b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot * 22b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot * For a real example, @see org.junit.tests.manipulation.SortableTest. 23b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot */ 24b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabotpublic class Enclosed extends Suite { 25b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot /** 26b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot * Only called reflectively. Do not use programmatically. 27b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot */ 28b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot public Enclosed(Class<?> klass, RunnerBuilder builder) throws Throwable { 29b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot super(builder, klass, klass.getClasses()); 30b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot } 31b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot} 32