Package org.junit.internal.requests

Source Code of org.junit.internal.requests.ClassRequest

package org.junit.internal.requests;

import org.junit.internal.builders.AllDefaultPossibilitiesBuilder;
import org.junit.runner.Request;
import org.junit.runner.Runner;

public class ClassRequest extends Request {
    private final Object fRunnerLock = new Object();
    private final Class<?> fTestClass;
    private final boolean fCanUseSuiteMethod;
    private Runner fRunner;

    public ClassRequest(Class<?> testClass, boolean canUseSuiteMethod) {
        fTestClass = testClass;
        fCanUseSuiteMethod = canUseSuiteMethod;
    }

    public ClassRequest(Class<?> testClass) {
        this(testClass, true);
    }

    @Override
    public Runner getRunner() {
        synchronized (fRunnerLock) {
            if (fRunner == null) {
                fRunner = new AllDefaultPossibilitiesBuilder(fCanUseSuiteMethod).safeRunnerForClass(fTestClass);
            }
            return fRunner;
        }
    }
}
TOP

Related Classes of org.junit.internal.requests.ClassRequest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.