All Classes and Interfaces

Class
Description
A TestSuite for active Tests.
If you allocate external resources in a Before method you need to release them after the test runs.
If you allocate expensive external resources in a BeforeClass method you need to release them after all the tests in the class have run.
 
Supplies Theory parameters based on all public members of the target class.
 
Runner for use with JUnit 3.8.x-style AllTests classes (those that only implement a static suite() method).
A sorter that orders tests alphanumerically by test name.
A model element that may have annotations.
The AnnotatedBuilder is a strategy for constructing runners for test class that have been annotated with the @RunWith annotation.
An AnnotationsValidator validates all annotations of a test class, including its annotated fields and methods.
 
 
 
 
Validates annotations on classes and methods.
Creates instances of Annotation Validators.
Thrown when two array elements differ
Deprecated.
Please use Assert instead.
A set of assertion methods useful for writing tests.
Thrown when an assertion failed.
A potentially incomplete list of value assignments for a method's formal parameters
A set of methods useful for stating assumptions about the conditions in which a test is meaningful.
An exception class used to implement assumptions (state in which a given test is meaningful and should or should not be executed).
An exception class used to implement assumptions (state in which a given test is meaningful and should or should not be executed).
Base class for all test runners.
When writing tests, it is common to find that several tests need similar objects created before they can run.
Sometimes several tests need to share computationally expensive setup (like logging into a database).
Implements the JUnit 4 standard test case class model, as defined by the annotations in the org.junit package.
 
A BlockJUnit4ClassRunner with parameters support.
 
 
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.
 
 
 
Marks a test class or test method as belonging to one or more categories of tests.
Implementation of FilterFactory for Category filtering.
Validates that there are no errors in the use of the Category annotation.
 
Miscellaneous functions dealing with classes.
 
Deprecated.
Included for backwards compatibility with JUnit 4.4.
Annotates static fields that reference rules or methods that return them.
 
Defines criteria for finding two items "equal enough".
Thrown when an assert equals for Strings failed.
Thrown when an assertEquals(String, String) fails.
 
Represents a strategy for computing runners and suites.
Thrown when Max cannot read the MaxCore serialization
Annotating an field or method with @DataPoint will cause the field value or the value returned by the method to be used as a potential parameter for theories in that class, when run with the Theories runner.
Annotating an array or iterable-typed field or method with @DataPoints will cause the values in the array or iterable given to be used as potential parameters for theories in that class when run with the Theories runner.
Represents an object that can describe itself
A Description describes a test which is to be run or has been run.
The DisableOnDebug Rule allows you to label certain rules to be disabled when debugging.
 
If you put tests in inner classes, Ant, for example, won't find them.
 
The ErrorCollector rule allows execution of a test to continue after the first problem is found (for example, to collect _all_ the incorrect rows in a table, and report them all at once):
 
 
FilterFactory to exclude categories.
 
The ExpectedException rule allows you to verify that your code throws a specific exception.
Builds special matcher used by ExpectedException.
 
A base class for Rules (like TemporaryFolder) that set up an external resource before a test (a file, socket, server, database connection, etc.), and guarantee to tear it down afterward:
 
Deprecated.
Included for backwards compatibility with JUnit 4.4.
 
Builder for FailOnTimeout.
A Failure holds a description of the failed test and the exception that was thrown while running it.
 
No-op implementation of RuntimeMXBean when the platform doesn't provide it.
No-op implementation of ThreadMXBean when the platform doesn't provide it.
The canonical case of filtering is when you want to run a single test method in a class.
Runners that allow filtering should implement this interface.
Utility class whose methods create a FilterFactory.
Extend this class to create a factory that creates Filter.
Exception thrown if the Filter cannot be created.
 
A filtered Request.
This class allows the user to choose the order of execution of the methods within a test class.
Represents a field on a test class (currently used only for Rules in BlockJUnit4ClassRunner, but custom runners can make other uses)
Parent class for FrameworkField and FrameworkMethod
Represents a method on a test class to be invoked at the appropriate point in test execution.
Annotating a parameter of a @Theory method with @FromDataPoints will limit the datapoints considered as potential values for that parameter to just the DataPoints with the given name.
Sometimes you want to temporarily disable a test or a group of tests.
 
 
FilterFactory to include categories.
 
 
Deprecated.
Represents one or more problems encountered while initializing a Runner
Thrown when an ordering does something invalid (like remove or add children)
Thrown by Runners in case the class under test is not valid.
 
 
 
 
Aliases the current default JUnit 4 class runner, for future-proofing.
 
Deprecated.
Included for backwards compatibility with JUnit 4.4.
The JUnit4TestAdapter enables running JUnit-4-style tests using a JUnit-3-style test runner.
 
 
 
Exception used if there's a problem parsing the command line.
JUnitCore is a facade for running tests.
Convenience import class: these are useful matchers for use with the assertThat method, but they are not currently included in the basic CoreMatchers class from hamcrest.
 
Reflective wrapper around ManagementFactory
 
 
 
A replacement for JUnitCore, which keeps track of runtime and failure history, and reorders tests to maximize the chances that a failing test occurs early in the test run.
Stores a subset of the history of each test: Last failure timestamp Duration of last execution
Represents a receiver for values of annotated fields/methods together with the declaring member.
 
Deprecated.
Included for backwards compatibility with JUnit 4.4.
A MethodRule is an alteration in how a test method is run and reported.
 
Sort the methods into a specified execution order.
Deprecated.
Included for backwards compatibility with JUnit 4.4.
Deprecated.
Collects multiple Throwables into one exception.
 
Thrown when a filter removes all tests from a runner.
 
Interface for runners that allow ordering of tests.
Orders tests.
Reorders tests.
Context about the ordering being applied.
Factory for creating Ordering instances.
 
When a test class is annotated with @OrderWith or extends a class annotated with @OrderWith, JUnit will order the tests in the test class (and child test classes, if any) using the ordering defined by the Ordering class.
Validates that there are no errors in the use of the OrderWith annotation.
 
The custom runner Parameterized implements parameterized tests.
Annotation for public static void methods which should be executed after evaluating tests with particular parameters.
 
Annotation for public static void methods which should be executed before evaluating tests with particular parameters.
Annotation for fields of the test class which will be initialized by the method annotated by Parameters.
Annotation for a method which provides parameters to be injected into the test class constructor by Parameterized.
 
Add this annotation to your test class if you want to generate a special runner.
 
 
A ParametersRunnerFactory creates a runner for a single TestWithParameters.
Annotating a Theory method parameter with @ParametersSuppliedBy causes it to be supplied with values from the named ParameterSupplier when run as a theory by the Theories runner.
Abstract parent class for suppliers of input data points for theories.
Provides most of the functionality specific to a Runner that implements a "parent node" in the test tree, with children defined by objects of some data type T.
 
 
 
A test result that prints nicely in error messages.
A Protectable can be run and can throw a Throwable.
Validates that a TestClass is public.
 
When invoked, throws the exception from the reflected method, rather than wrapping it in an InvocationTargetException.
Implementation of RuntimeMXBean using the JVM reflectively.
 
Implementation of ThreadMXBean using the JVM reflectively.
 
A Decorator that runs a test repeatedly.
A Request is an abstract description of tests to be run.
A Result collects and summarizes information from running multiple tests.
Represents the serialized output of Result.
Matchers on a PrintableResult, to enable JUnit self-tests.
 
Annotates fields that reference rules or methods that return a rule.
The RuleChain can be used for creating composite rules.
Data structure for ordering of TestRule/MethodRule instances.
 
A RuleMemberValidator validates the rule fields/methods of a TestClass.
 
Requires the member's declaring class to be public
Requires the member is a field implementing MethodRule or TestRule
Requires the member is a field implementing TestRule
Requires the validated member to be non-static
Requires the member to be public
Requires the member to be static
Require the member to return an implementation of MethodRule or TestRule
Require the member to return an implementation of TestRule
Encapsulates a single piece of validation logic, used to determine if Rule and ClassRule annotations have been used correctly
 
 
Register an instance of this class with RunNotifier to be notified of events that occur during a test run.
Indicates a RunListener that can have its methods called concurrently.
A Runner runs tests and notifies a RunNotifier of significant events as it does so.
A RunnerBuilder is a strategy for constructing runners for classes.
Represents a strategy for scheduling when individual test methods should be run (in serial or parallel) WARNING: still experimental, may go away.
If you write custom runners, you may need to notify JUnit of your progress running tests.
Runs a collection of rules on a statement.
Wrapper for RuntimeMXBean.
When a class is annotated with @RunWith or extends a class annotated with @RunWith, JUnit will invoke the class it references to run the tests in that class instead of the runner built into JUnit.
This class exists solely to provide a serializable description of a matcher to be serialized as a field in AssumptionViolatedException.
This class exists solely to provide a serializable description of a value to be serialized as a field in AssumptionViolatedException.
Interface for runners that allow sorting of tests.
A Sorter orders tests.
 
 
A matcher that delegates to throwableMatcher and in addition appends the stacktrace of the actual Throwable in case of a mismatch.
Represents one or more actions to be taken at runtime in the course of running a JUnit test suite.
Thrown when a user has requested that the test run stop.
The Stopwatch Rule notifies one of its own protected methods of the time spent by a test.
 
Using Suite as a runner allows you to manually build a suite containing tests from many classes.
The SuiteClasses annotation specifies the classes to be run when a class annotated with @RunWith(Suite.class) is run.
Runner for use with JUnit 3.8.x-style AllTests classes (those that only implement a static suite() method).
 
Thread-safe decorator for RunListener implementations that synchronizes calls to the delegate.
The TemporaryFolder Rule allows creation of files and folders that should be deleted when the test method finishes (whether it passes or fails).
Builds an instance of TemporaryFolder.
A Test can be run and collect its results.
The Test annotation tells JUnit that the public void method to which it is attached can be run as a test case.
Default empty exception.
A test case defines the fixture to run multiple tests.
Deprecated.
Included for backwards compatibility with JUnit 4.4.
Wraps a class to be run, providing method validation and annotation searching
Compares two fields by its name.
Compares two methods by its name.
Validates a single facet of a test class.
Indicates that a test that indicated that it should be skipped could not be skipped.
A Decorator for Tests.
Annotating a Theory method int parameter with @TestedOn causes it to be supplied with values from the ints array given when run as a theory by the Theories runner.
 
A TestFailure collects a failed test together with the caught exception.
A Listener for test progress
Deprecated.
Included for backwards compatibility with JUnit 4.4.
The TestName Rule makes the current test name available inside test methods:
A TestResult collects the results of executing a test case.
A TestRule is an alteration in how a test method, or set of test methods, is run and reported.
A listener interface for observing the execution of a test run.
A command line based tool to run tests.
A Decorator to set up and tear down additional fixture state.
A TestSuite is a Composite of Tests.
Exception thrown when a test fails on timeout.
TestWatcher is a base class for Rules that take note of the testing action, without modifying it.
Deprecated.
Use TestWatcher (which implements TestRule) instead.
A TestWithParameters keeps the data together that are needed for creating a runner for a single data set of a parameterized test.
 
The Theories runner allows to test a certain functionality against a subset of an infinite set of data points.
 
Marks test methods that should be read as theories by the Theories runner.
Wrapper for ThreadMXBean.
A matcher that applies a delegate matcher to the cause of the current Throwable, returning the result of that match.
 
Miscellaneous functions dealing with Throwable.
 
This interface facilitates the use of Assert.assertThrows(Class, ThrowingRunnable) from Java 8.
The Timeout Rule applies the same timeout to all test methods in a class:
Builder for Timeout.
Deprecated.
Please use TypeSafeMatcher.
Allows for an AnnotationValidator to be attached to an annotation.
 
Verifier is a base class for Rules like ErrorCollector, which can turn otherwise passing test methods into failing tests if a verification check is failed
This class defines the current version of JUnit