org.springframework.test.context.junit4.SpringJUnit4ClassRunner Java Examples

The following examples show how to use org.springframework.test.context.junit4.SpringJUnit4ClassRunner. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SeparateClassloaderTestRunner.java    From sofa-tracer with Apache License 2.0 6 votes vote down vote up
public SeparateClassloaderTestRunner(Class<?> clazz) throws InitializationError {
    super(clazz);
    try {
        Class springJUnit4ClassRunnerClass = separateClassloader
            .loadClass(SpringJUnit4ClassRunner.class.getName());
        Constructor constructor = springJUnit4ClassRunnerClass.getConstructor(Class.class);
        ExcludeClasses annotation = clazz.getAnnotation(ExcludeClasses.class);

        clazzLoadBySeparateClassloader = separateClassloader.loadClass(clazz.getName());
        runnerObject = constructor.newInstance(clazzLoadBySeparateClassloader);
        runMethod = springJUnit4ClassRunnerClass.getMethod("run", RunNotifier.class);
        if (annotation != null) {
            excludeClasses = annotation.value();
        }
    } catch (Throwable e) {
        throw new InitializationError(e);
    }
}