org.junit.experimental.categories
Class Categories

java.lang.Object
  extended by org.junit.runner.Runner
      extended by org.junit.runners.ParentRunner<Runner>
          extended by org.junit.runners.Suite
              extended by org.junit.experimental.categories.Categories
All Implemented Interfaces:
Describable, Filterable, Sortable

public class Categories
extends Suite

From a given set of test classes, runs only the classes and methods that are annotated with either the category given with the @IncludeCategory annotation, or a subtype of that category. Example:

 public interface FastTests extends CategoryType {
 }
 
 public interface SlowTests extends CategoryType {
 }
 
 public static class A {
        @Test
        public void a() {
                fail();
        }
 
        @Category(SlowTests.class)
        @Test
        public void b() {
        }
 }
 
 @Category( { SlowTests.class, FastTests.class })
 public static class B {
        @Test
        public void c() {
 
        }
 }
 
 @RunWith(Categories.class)
 @IncludeCategory(SlowTests.class)
 @SuiteClasses( { A.class, B.class })
 // Note that Categories is a kind of Suite
 public static class SlowTestSuite {
 }
 


Nested Class Summary
static class Categories.CategoryFilter
           
static interface Categories.ExcludeCategory
           
static interface Categories.IncludeCategory
           
 
Nested classes/interfaces inherited from class org.junit.runners.Suite
Suite.SuiteClasses
 
Constructor Summary
Categories(Class<?> klass, RunnerBuilder builder)
           
 
Method Summary
 
Methods inherited from class org.junit.runners.Suite
describeChild, emptySuite, getChildren, runChild
 
Methods inherited from class org.junit.runners.ParentRunner
childrenInvoker, classBlock, collectInitializationErrors, filter, getDescription, getName, getTestClass, run, setScheduler, sort, validatePublicVoidNoArgMethods, withAfterClasses, withBeforeClasses
 
Methods inherited from class org.junit.runner.Runner
testCount
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Categories

public Categories(Class<?> klass,
                  RunnerBuilder builder)
           throws InitializationError
Throws:
InitializationError



API Documentation hosted by AppDoc.app (https://appdoc.app)