// Path: src/main/java/de/bechte/junit/runners/context/processing/ChildResolver.java
// public interface ChildResolver<T extends Object> {
//     /**
//      * Resolved the children of type T for the given {@link TestClass}.
//      *
//      * @param testClass the {@link TestClass} to resolve the children for
//      * @return a {@link List} of children of type T
//      */
//     public List<T> getChildren(final TestClass testClass);
// }
// 
// Path: src/main/java/de/bechte/junit/runners/context/processing/ContextResolver.java
// public class ContextResolver implements ChildResolver<Class<?>> {
//     public List<Class<?>> getChildren(final TestClass testClass) {
//         if (testClass == null)
//             return Collections.emptyList();
// 
//         final Class<?>[] memberClasses = testClass.getJavaClass().getClasses();
//         final List<Class<?>> contexts = new ArrayList<Class<?>>(memberClasses.length);
//         for (final Class<?> memberClass : memberClasses)
//             if (isAllowed(memberClass))
//                 contexts.add(memberClass);
//         return contexts;
//     }
// 
//     /**
//      * Verifies, if the given {@code candidate} is allowed. If this method return {@code false} the candidate will be
//      * removed from the list of children returned by {@link #getChildren(org.junit.runners.model.TestClass)}.
//      *
//      * Note: Clients may override this method to provide custom filtering.
//      *
//      * @param candidate the candidate to verify
//      * @return a boolean value
//      */
//     protected boolean isAllowed(final Class<?> candidate) {
//         return isNotAbstract(candidate) && isNotStatic(candidate) && isPublic(candidate) && isNotIgnored(candidate);
//     }
// 
//     private boolean isNotAbstract(Class<?> candidate) {
//         return !Modifier.isAbstract(candidate.getModifiers());
//     }
// 
//     private boolean isNotStatic(Class<?> candidate) {
//         return !Modifier.isStatic(candidate.getModifiers());
//     }
// 
//     private boolean isPublic(Class<?> candidate) {
//         return Modifier.isPublic(candidate.getModifiers());
//     }
// 
//     private boolean isNotIgnored(Class<?> candidate) {
//         return candidate.getAnnotation(Ignore.class) == null;
//     }
// }
// 
// Path: src/main/java/de/bechte/junit/runners/context/processing/MethodResolver.java
// public class MethodResolver implements ChildResolver<FrameworkMethod> {
//     public List<FrameworkMethod> getChildren(final TestClass testClass) {
//         if (testClass == null)
//             return Collections.emptyList();
// 
//         return testClass.getAnnotatedMethods(Test.class);
//     }
// }


import de.bechte.junit.runners.context.processing.ChildResolver;
import de.bechte.junit.runners.context.processing.ContextResolver;
import de.bechte.junit.runners.context.processing.MethodResolver;
import org.junit.runners.model.TestClass;
import java.util.List;
package de.bechte.junit.runners.validation;



/**
 * The {@link ChildrenCountValidator}s validate that the given {@link TestClass} contains at least 1 child. If there
 * is no child within the {@link TestClass} an error is reported in the {@link List} of errors.
 */
public enum ChildrenCountValidator implements TestClassValidator {
    TEST_METHODS(new MethodResolver(), "No tests found!"),
    CONTEXT_HIERARCHIES(new ContextResolver(), "No contexts found!");

    private final ChildResolver<?> childResolver;
    private final String errorMessage;

    private ChildrenCountValidator(final ChildResolver<?> childResolver, final String errorMessage) {
        this.childResolver = childResolver;
        this.errorMessage = errorMessage;
    }

    public void validate(final TestClass testClass, final List<Throwable> errors) {
        if (childResolver.getChildren(testClass).isEmpty())
// Path: src/main/java/de/bechte/junit/runners/context/processing/ChildResolver.java
// public interface ChildResolver<T extends Object> {
//     /**
//      * Resolved the children of type T for the given {@link TestClass}.
//      *
//      * @param testClass the {@link TestClass} to resolve the children for
//      * @return a {@link List} of children of type T
//      */
//     public List<T> getChildren(final TestClass testClass);
// }
// 
// Path: src/main/java/de/bechte/junit/runners/context/processing/ContextResolver.java
// public class ContextResolver implements ChildResolver<Class<?>> {
//     public List<Class<?>> getChildren(final TestClass testClass) {
//         if (testClass == null)
//             return Collections.emptyList();
// 
//         final Class<?>[] memberClasses = testClass.getJavaClass().getClasses();
//         final List<Class<?>> contexts = new ArrayList<Class<?>>(memberClasses.length);
//         for (final Class<?> memberClass : memberClasses)
//             if (isAllowed(memberClass))
//                 contexts.add(memberClass);
//         return contexts;
//     }
// 
//     /**
//      * Verifies, if the given {@code candidate} is allowed. If this method return {@code false} the candidate will be
//      * removed from the list of children returned by {@link #getChildren(org.junit.runners.model.TestClass)}.
//      *
//      * Note: Clients may override this method to provide custom filtering.
//      *
//      * @param candidate the candidate to verify
//      * @return a boolean value
//      */
//     protected boolean isAllowed(final Class<?> candidate) {
//         return isNotAbstract(candidate) && isNotStatic(candidate) && isPublic(candidate) && isNotIgnored(candidate);
//     }
// 
//     private boolean isNotAbstract(Class<?> candidate) {
//         return !Modifier.isAbstract(candidate.getModifiers());
//     }
// 
//     private boolean isNotStatic(Class<?> candidate) {
//         return !Modifier.isStatic(candidate.getModifiers());
//     }
// 
//     private boolean isPublic(Class<?> candidate) {
//         return Modifier.isPublic(candidate.getModifiers());
//     }
// 
//     private boolean isNotIgnored(Class<?> candidate) {
//         return candidate.getAnnotation(Ignore.class) == null;
//     }
// }
// 
// Path: src/main/java/de/bechte/junit/runners/context/processing/MethodResolver.java
// public class MethodResolver implements ChildResolver<FrameworkMethod> {
//     public List<FrameworkMethod> getChildren(final TestClass testClass) {
//         if (testClass == null)
//             return Collections.emptyList();
// 
//         return testClass.getAnnotatedMethods(Test.class);
//     }
// }


// Path: src/main/java/de/bechte/junit/runners/validation/ChildrenCountValidator.java
import de.bechte.junit.runners.context.processing.ChildResolver;
import de.bechte.junit.runners.context.processing.ContextResolver;
import de.bechte.junit.runners.context.processing.MethodResolver;
import org.junit.runners.model.TestClass;
import java.util.List;

package de.bechte.junit.runners.validation;



/**
 * The {@link ChildrenCountValidator}s validate that the given {@link TestClass} contains at least 1 child. If there
 * is no child within the {@link TestClass} an error is reported in the {@link List} of errors.
 */
public enum ChildrenCountValidator implements TestClassValidator {
    TEST_METHODS(new MethodResolver(), "No tests found!"),
    CONTEXT_HIERARCHIES(new ContextResolver(), "No contexts found!");

    private final ChildResolver<?> childResolver;
    private final String errorMessage;

    private ChildrenCountValidator(final ChildResolver<?> childResolver, final String errorMessage) {
        this.childResolver = childResolver;
        this.errorMessage = errorMessage;
    }

    public void validate(final TestClass testClass, final List<Throwable> errors) {
        if (childResolver.getChildren(testClass).isEmpty())
            errors.add(new Exception(errorMessage));