public class ExpectedTimeoutRule
extends java.lang.Object
implements org.junit.rules.TestRule
| Modifier and Type | Method and Description |
|---|---|
org.junit.runners.model.Statement |
apply(org.junit.runners.model.Statement base,
org.junit.runner.Description description) |
void |
expect(java.lang.Class<? extends java.lang.Throwable> type)
Adds to the list of requirements for any thrown exception that it should
be an instance of
type. |
void |
expect(org.hamcrest.Matcher<?> matcher)
Adds
matcher to the list of requirements for any thrown exception. |
void |
expectCause(org.hamcrest.Matcher<? extends java.lang.Throwable> expectedCause)
Adds
matcher to the list of requirements for the cause of
any thrown exception. |
ExpectedTimeoutRule |
expectMaximumDuration(long maxDuration) |
void |
expectMessage(org.hamcrest.Matcher<java.lang.String> matcher)
Adds
matcher to the list of requirements for the message returned
from any thrown exception. |
void |
expectMessage(java.lang.String substring)
Adds to the list of requirements for any thrown exception that it should
contain string
substring |
ExpectedTimeoutRule |
expectMinimumDuration(long minDuration) |
protected boolean |
expectsThrowable()
Returns true if a Throwable is expected.
|
protected boolean |
expectsTimeout()
Returns true if a timeout is expected.
|
ExpectedTimeoutRule |
expectTimeUnit(java.util.concurrent.TimeUnit timeUnit) |
static ExpectedTimeoutRule |
none() |
public static ExpectedTimeoutRule none()
public ExpectedTimeoutRule expectMinimumDuration(long minDuration)
public ExpectedTimeoutRule expectMaximumDuration(long maxDuration)
public ExpectedTimeoutRule expectTimeUnit(java.util.concurrent.TimeUnit timeUnit)
public void expect(org.hamcrest.Matcher<?> matcher)
matcher to the list of requirements for any thrown exception.public void expect(java.lang.Class<? extends java.lang.Throwable> type)
type.public void expectMessage(java.lang.String substring)
substringpublic void expectMessage(org.hamcrest.Matcher<java.lang.String> matcher)
matcher to the list of requirements for the message returned
from any thrown exception.public void expectCause(org.hamcrest.Matcher<? extends java.lang.Throwable> expectedCause)
matcher to the list of requirements for the cause of
any thrown exception.protected boolean expectsTimeout()
protected boolean expectsThrowable()
public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base,
org.junit.runner.Description description)
apply in interface org.junit.rules.TestRule