public class


extends Suite
   ↳ org.junit.runner.Runner
     ↳ org.junit.runners.ParentRunner<T>
       ↳ org.junit.runners.Suite
         ↳ org.junit.runners.Parameterized

Class Overview

The custom runner Parameterized implements parameterized tests. When running a parameterized test class, instances are created for the cross-product of the test methods and the test data elements.

For example, to test a Fibonacci function, write:
 public class FibonacciTest {
 	public static List<Object[]> data() {
 		return Arrays.asList(new Object[][] {
 				{ { 0, 0 }, { 1, 1 }, { 2, 1 }, { 3, 2 }, { 4, 3 }, { 5, 5 },
 						{ 6, 8 } } });
 	private int fInput;
 	private int fExpected;
 	public FibonacciTest(int input, int expected) {
 		fInput= input;
 		fExpected= expected;
 	public void test() {
 		assertEquals(fExpected, Fibonacci.compute(fInput));

Each instance of FibonacciTest will be constructed using the two-argument constructor and the data values in the @Parameters method.


Nested Classes
@interface Parameterized.Parameters Annotation for a method which provides parameters to be injected into the test class constructor by Parameterized  
Public Constructors
Parameterized(Class<?> klass)
Only called reflectively.
Protected Methods
List<Runner> getChildren()
Returns a list of objects that define the children of this Runner.
Inherited Methods
From class org.junit.runners.Suite
From class org.junit.runners.ParentRunner
From class org.junit.runner.Runner
From class java.lang.Object
From interface org.junit.runner.Describable
From interface org.junit.runner.manipulation.Filterable
From interface org.junit.runner.manipulation.Sortable

Public Constructors

public Parameterized (Class<?> klass)

Only called reflectively. Do not use programmatically.


Protected Methods

protected List<Runner> getChildren ()

Returns a list of objects that define the children of this Runner.