All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.junit.internal.requests.ClassRequest Maven / Gradle / Ivy

Go to download

JUnit is a regression testing framework written by Erich Gamma and Kent Beck. It is used by the developer who implements unit tests in Java.

There is a newer version: 4.13.2
Show newest version
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;
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy