Top Description Inners Fields Constructors Methods
org.eclipse.jgit.junit

public Class RepeatRule

extends Object
implements TestRule
Class Inheritance
All Implemented Interfaces
org.junit.rules.TestRule
Imports
java.text.MessageFormat, java.util.logging.Level, .Logger, org.junit.rules.TestRule, org.junit.runner.Description, org.junit.runners.model.Statement

org.junit.rules.TestRule which enables to run the same JUnit test repeatedly. Add this rule to the test class
public class MyTest {
	@Rule
	public RepeatRule repeatRule = new RepeatRule();
	...
}
and annotate the test to be repeated with the @Repeat(n=<repetitions>) annotation
@Test
@Repeat(n = 100)
public void test() {
	...
}
then this test will be repeated 100 times. If any test execution fails test repetition will be stopped.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
RepeatRule.RepeatedTestException

Exception thrown if repeated execution of a test annotated with @Repeat failed.

private static class

Field Summary

Modifier and TypeField and Description
private static final Logger

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Statement
apply(Statement
The Statement to be modified
statement
,
Description
A Description of the test implemented in base
description
)

Implements org.junit.rules.TestRule.apply.

Modifies the method-running Statement to implement this test-running rule.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

LOGback to summary
private static final Logger LOG

Constructor Detail

RepeatRuleback to summary
public RepeatRule()

Method Detail

applyback to summary
public Statement apply(Statement statement, Description description)

Implements org.junit.rules.TestRule.apply.

Doc from org.junit.rules.TestRule.apply.

Modifies the method-running Statement to implement this test-running rule.

Parameters
statement:Statement

The Statement to be modified

description:Description

A Description of the test implemented in base

Returns:Statement

a new statement, which may be the same as base, a wrapper around base, or a completely new Statement.

Annotations
@Override
org.eclipse.jgit.junit back to summary

public Class RepeatRule.RepeatedTestException

extends RuntimeException
Class Inheritance

Exception thrown if repeated execution of a test annotated with @Repeat failed.

Field Summary

Modifier and TypeField and Description
private static final long

Constructor Summary

AccessConstructor and Description
public
RepeatedTestException(String
the error message
message
)

Constructor

public
RepeatedTestException(String
the error message
message
,
Throwable
exception causing this exception
cause
)

Constructor

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.lang.RuntimeException.serialVersionUID.

Constructor Detail

RepeatedTestExceptionback to summary
public RepeatedTestException(String message)

Constructor

Parameters
message:String

the error message

Since
5.1.9
RepeatedTestExceptionback to summary
public RepeatedTestException(String message, Throwable cause)

Constructor

Parameters
message:String

the error message

cause:Throwable

exception causing this exception

org.eclipse.jgit.junit back to summary

private Class RepeatRule.RepeatStatement

extends Statement
Class Inheritance

Field Summary

Modifier and TypeField and Description
private boolean
private final int
private final Statement

Constructor Summary

AccessConstructor and Description
private
RepeatStatement(int repetitions, boolean abortOnFailure, Statement statement)

Method Summary

Modifier and TypeMethod and Description
public void
evaluate()

Implements abstract org.junit.runners.model.Statement.evaluate.

Run the action, throwing a Throwable if anything goes wrong.

Field Detail

abortOnFailureback to summary
private boolean abortOnFailure
repetitionsback to summary
private final int repetitions
statementback to summary
private final Statement statement

Constructor Detail

RepeatStatementback to summary
private RepeatStatement(int repetitions, boolean abortOnFailure, Statement statement)

Method Detail

evaluateback to summary
public void evaluate() throws Throwable

Implements abstract org.junit.runners.model.Statement.evaluate.

Doc from org.junit.runners.model.Statement.evaluate.

Run the action, throwing a Throwable if anything goes wrong.

Annotations
@Override