org.junit.experimental.categories.IncludeCategories Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of virtdata-lib-curves4 Show documentation
Show all versions of virtdata-lib-curves4 Show documentation
Statistical sampling library for use in virtdata libraries, based
on apache commons math 4
package org.junit.experimental.categories;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.junit.experimental.categories.Categories.CategoryFilter;
import org.junit.runner.manipulation.Filter;
/**
* {@link org.junit.runner.FilterFactory} to include categories.
*
* The {@link Filter} that is created will filter out tests that are categorized with any of the
* given categories.
*
* Usage from command line:
*
* --filter=org.junit.experimental.categories.IncludeCategories=pkg.of.Cat1,pkg.of.Cat2
*
*
* Usage from API:
*
* new IncludeCategories().createFilter(Cat1.class, Cat2.class);
*
*/
public final class IncludeCategories extends CategoryFilterFactory {
/**
* Creates a {@link Filter} which is only passed by tests that are
* categorized with any of the specified categories.
*
* @param categories Category classes.
*/
@Override
protected Filter createFilter(List> categories) {
return new IncludesAny(categories);
}
private static class IncludesAny extends CategoryFilter {
public IncludesAny(List> categories) {
this(new HashSet>(categories));
}
public IncludesAny(Set> categories) {
super(true, categories, true, null);
}
@Override
public String describe() {
return "includes " + super.describe();
}
}
}