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

com.atlassian.clover.instr.tests.naming.DefaultTestNameExtractor Maven / Gradle / Ivy

Go to download

Clover is an award winning code coverage and testing tool for Java and Groovy. It integrates easily with Maven, Ant, Grails, Eclipse and IntelliJ IDEA as well as with continuous integration servers such as Bamboo, Jenkins or Hudson. Note: before Clover 4.0 this artifact was named com.cenqua.clover:clover.

The newest version!
package com.atlassian.clover.instr.tests.naming;

import com.atlassian.clover.api.registry.MethodInfo;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.List;

import static org.openclover.util.Lists.newArrayList;

/**
 * Standard implementation of the "combined" test extractor supporting:
 *  - Spock framework features
 *  - JUnit4 parameterized tests
 *  - plain methods
 */
public class DefaultTestNameExtractor implements TestNameExtractor {

    public static final TestNameExtractor INSTANCE = new DefaultTestNameExtractor();

    private static final List TEST_EXTRACTORS = newArrayList(
            new JUnitParameterizedTestExtractor(),
            new SpockFeatureNameExtractor(),
            new NullNameExtractor());

    @Override
    @Nullable
    public String getTestNameForMethod(@NotNull MethodInfo methodInfo) {
        for (final TestNameExtractor extractor : TEST_EXTRACTORS) {
            final String testName = extractor.getTestNameForMethod(methodInfo);
            if (testName != null) {
                return testName;
            }
        }
        return null;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy