congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
CategoryFilter
Code IndexAdd Tabnine to your IDE (free)

How to use
CategoryFilter
in
com.novocode.junit

Best Java code snippets using com.novocode.junit.CategoryFilter (Showing top 14 results out of 315)

origin: com.novocode/junit-interface

public static CategoryFilter categoryFilter(boolean matchAnyInclusions, Set<Class<?>> inclusions,
                      boolean matchAnyExclusions, Set<Class<?>> exclusions) {
  return new CategoryFilter(matchAnyInclusions, inclusions, matchAnyExclusions, exclusions);
}
origin: com.novocode/junit-interface

public static CategoryFilter exclude(boolean matchAny, Class<?>... categories) {
  if (hasNull(categories)) {
    throw new NullPointerException("has null category");
  }
  return categoryFilter(true, null, matchAny, createSet(categories));
}
origin: com.novocode/junit-interface

protected CategoryFilter(boolean matchAnyIncludes, Set<Class<?>> includes,
             boolean matchAnyExcludes, Set<Class<?>> excludes) {
  includedAny = matchAnyIncludes;
  excludedAny = matchAnyExcludes;
  included = copyAndRefine(includes);
  excluded = copyAndRefine(excludes);
}
origin: com.novocode/junit-interface

private static Set<Class<?>> categories(Description description) {
  Set<Class<?>> categories= new HashSet<Class<?>>();
  Collections.addAll(categories, directCategories(description));
  Collections.addAll(categories, directCategories(parentDescription(description)));
  return categories;
}
origin: com.novocode/junit-interface

private boolean hasCorrectCategoryAnnotation(Description description) {
  final Set<Class<?>> childCategories= categories(description);
  // If a child has no categories, immediately return.
  if (childCategories.isEmpty()) {
    return included.isEmpty();
  }
  if (!excluded.isEmpty()) {
    if (excludedAny) {
      if (matchesAnyParentCategories(childCategories, excluded)) {
        return false;
      }
    } else {
      if (matchesAllParentCategories(childCategories, excluded)) {
        return false;
      }
    }
  }
  if (included.isEmpty()) {
    // Couldn't be excluded, and with no suite's included categories treated as should run.
    return true;
  } else {
    if (includedAny) {
      return matchesAnyParentCategories(childCategories, included);
    } else {
      return matchesAllParentCategories(childCategories, included);
    }
  }
}
origin: stackoverflow.com

 VolumeQuery query = new VolumeQuery(
  new URL("http://www.google.com/books/feeds/users/USER_ID/collections/library/volumes"));
CategoryFilter filter = new CategoryFilter();;
filter.addCategory(
  new Category(BooksCategory.Scheme.LABELS_SCHEME, "favorite"));
query.addCategoryFilter(filter);
VolumeFeed volumeFeed = service.query(query, VolumeFeed.class);
origin: com.novocode/junit-interface

@Override
public boolean shouldRun(Description description) {
  if (hasCorrectCategoryAnnotation(description)) {
    return true;
  }
  for (Description each : description.getChildren()) {
    if (shouldRun(each)) {
      return true;
    }
  }
  return false;
}
origin: com.novocode/junit-interface

/**
 * @return <tt>false</tt> if at least one parent category does not match children, otherwise <tt>true</tt>.
 * If empty <tt>parentCategories</tt>, returns <tt>true</tt>.
 */
private boolean matchesAllParentCategories(Set<Class<?>> childCategories, Set<Class<?>> parentCategories) {
  for (Class<?> parentCategory : parentCategories) {
    if (!hasAssignableTo(childCategories, parentCategory)) {
      return false;
    }
  }
  return true;
}
origin: com.novocode/junit-interface

public static CategoryFilter exclude(Class<?> category) {
  return exclude(true, category);
}
origin: com.novocode/junit-interface

if(!includeCategories.isEmpty() || !excludeCategories.isEmpty()) {
 request = new SilentFilterRequest(request,
     CategoryFilter.categoryFilter(true, loadClasses(testClassLoader, includeCategories), true,
         loadClasses(testClassLoader, excludeCategories)));
origin: com.novocode/junit-interface

/**
 * @return <tt>true</tt> if at least one (any) parent category match a child, otherwise <tt>false</tt>.
 * If empty <tt>parentCategories</tt>, returns <tt>false</tt>.
 */
private boolean matchesAnyParentCategories(Set<Class<?>> childCategories, Set<Class<?>> parentCategories) {
  for (Class<?> parentCategory : parentCategories) {
    if (hasAssignableTo(childCategories, parentCategory)) {
      return true;
    }
  }
  return false;
}
origin: com.novocode/junit-interface

public static CategoryFilter exclude(Class<?>... categories) {
  return exclude(true, categories);
}
origin: com.novocode/junit-interface

public static CategoryFilter include(boolean matchAny, Class<?>... categories) {
  if (hasNull(categories)) {
    throw new NullPointerException("has null category");
  }
  return categoryFilter(matchAny, createSet(categories), true, null);
}
origin: stackoverflow.com

super(suiteClass, builder);
try {
  filter(new CategoryFilter(getIncludedCategory(suiteClass),
      getExcludedCategory(suiteClass)));
  filter(new DevFilter());
com.novocode.junitCategoryFilter

Javadoc

Copied from https://github.com/junit-team/junit/blob/master/src/main/java/org/junit/experimental/categories/Categories.java, since JUnit 4.11 only supports including/excluding one category at a time, and since it's an experimental API that could change at any time.

Most used methods

  • <init>
  • addCategory
  • categories
  • categoryFilter
  • copyAndRefine
  • createSet
  • directCategories
  • exclude
  • hasAssignableTo
  • hasCorrectCategoryAnnotation
  • hasNull
  • include
  • hasNull,
  • include,
  • matchesAllParentCategories,
  • matchesAnyParentCategories,
  • parentDescription,
  • shouldRun,
  • toString

Popular in Java

  • Making http post requests using okhttp
  • scheduleAtFixedRate (Timer)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • putExtra (Intent)
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • List (java.util)
    An ordered collection (also known as a sequence). The user of this interface has precise control ove
  • NoSuchElementException (java.util)
    Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
  • Timer (java.util)
    Timers schedule one-shot or recurring TimerTask for execution. Prefer java.util.concurrent.Scheduled
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now