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

org.deflaker.surefire.FixedJUnit4ProviderUtil Maven / Gradle / Ivy

There is a newer version: 2.19.4
Show newest version
package org.deflaker.surefire;

import java.util.HashSet;
import java.util.List;
import java.util.Set;

import org.apache.maven.surefire.common.junit4.ClassMethod;
import org.apache.maven.surefire.common.junit4.JUnit4ProviderUtil;
import org.junit.runner.Description;
import org.junit.runner.notification.Failure;

public class FixedJUnit4ProviderUtil {
	/**
     * Get all test methods from a list of Failures
     *
     * @param allFailures the list of failures for a given test class
     * @return the list of test methods
     */
    public static Set generateFailingTests( List allFailures )
    {
        Set failingMethods = new HashSet();

        for ( Failure failure : allFailures )
        {
            Description description = failure.getDescription();
        	if(description.getChildren() != null && description.getChildren().size() == 1)
        		description = description.getChildren().get(0);
            if ( description.isTest() && !JUnit4ProviderUtil.isFailureInsideJUnitItself( description ) )
            {
                ClassMethod classMethod = JUnit4ProviderUtil.cutTestClassAndMethod( description );
                if ( classMethod.isValid() )
                {
                    failingMethods.add( classMethod );
                }
            }
        }
        return failingMethods;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy