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

net.thucydides.junit.finder.TestMethodFinder Maven / Gradle / Ivy

package net.thucydides.junit.finder;

import ch.lambdaj.function.matcher.Predicate;
import org.hamcrest.Matcher;

import java.lang.reflect.Method;
import java.util.List;

import static ch.lambdaj.Lambda.filter;

public class TestMethodFinder {

    private final TestFinder testFinder;

    public TestMethodFinder(TestFinder testFinder) {
        this.testFinder = testFinder;
    }

    public List withNameContaining(String partialName) {
        return filter(methodsWithPartialName(partialName), testFinder.getAllTestMethods());
    }

    Matcher methodsWithPartialName(final String partialName) {
        return new Predicate() {
            public boolean apply(Method testMethod) {
                return testMethod.getName().contains(partialName);
            }
        };
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy