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

com.github.bookong.zest.core.RunZestAfters Maven / Gradle / Ivy

package com.github.bookong.zest.core;

import java.util.ArrayList;
import java.util.List;

import org.junit.runners.model.FrameworkMethod;
import org.junit.runners.model.MultipleFailureException;
import org.junit.runners.model.Statement;

/**
 * @author jiangxu
 *
 */
public class RunZestAfters extends AbstractStatement {
	private final Statement fNext;
    private final List fAfters;

    public RunZestAfters(Launcher launcher, Object target, Statement next, List afters) {
    	super(launcher, target);
    	fNext = next;
        fAfters = afters;
    }

    @Override
    public void evaluate() throws Throwable {
        List errors = new ArrayList();
        try {
            fNext.evaluate();
        } catch (Throwable e) {
            errors.add(e);
        } finally {
            for (FrameworkMethod each : fAfters) {
                try {
                	invokeMethod(each);
                } catch (Throwable e) {
                    errors.add(e);
                }
            }
        }
        MultipleFailureException.assertEmpty(errors);
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy