public class RedTestContext extends Object
RedTestContext
instance exposes all of JUnit Assert
interface, so that assertions can be made from any context, and still
influence test results.scheduleTask(long, TimeUnit, Runnable)
.fork()
Modifier and Type | Class and Description |
---|---|
class |
RedTestContext.Assertions
Exposes JUnit
Assert interface,
wraps each assertion method with a call to assertion(EmptyCallback) |
static class |
RedTestContext.Fork
A fork of a
RedTestContext
see fork() |
class |
RedTestContext.TimingValidator
A Timing tester for a certain
RedTestContext
May be used to validate expected periods of time to pass or not pass,
from the moment of it's creation. |
Modifier and Type | Field and Description |
---|---|
RedTestContext.Assertions |
assertions
The context assertion interface
|
Modifier and Type | Method and Description |
---|---|
void |
fail()
Fails the test.
|
void |
fail(String message)
Fails the test.
|
void |
fail(Throwable throwable)
Fails the test.
|
RedTestContext.Fork |
fork()
Forks the test, and returns the fork instance.
|
boolean |
isTestActive()
In some cases, in a late callback of an async operation,
it may be reasonable to validate whether or not the test is still active, or completed.
|
void |
scheduleTask(long delayMillis,
Runnable runnable)
Schedules a late runnable to be executed with a given delay of milliseconds.
|
void |
scheduleTask(long delay,
TimeUnit unit,
Runnable runnable)
Schedules a late runnable to be executed.
|
RedTestContext.TimingValidator |
timingValidator()
A
RedTestContext provides a method for validating timing executions. |
public final RedTestContext.Assertions assertions
public RedTestContext.Fork fork()
public void fail(Throwable throwable)
throwable
- causepublic void fail(String message)
message
- reasonpublic void fail()
public void scheduleTask(long delay, TimeUnit unit, Runnable runnable)
delay
- the delay of the execution to applyunit
- the time unit the of given delayrunnable
- the runnable task to executepublic void scheduleTask(long delayMillis, Runnable runnable)
delayMillis
- the delay of the execution to apply in millisecondsrunnable
- the runnable task to executepublic RedTestContext.TimingValidator timingValidator()
RedTestContext
provides a method for validating timing executions.
A RedTestContext.TimingValidator
may be created at a certain point at time, and later,
this RedTestContext.TimingValidator
instance may be used to validate certain period of
time has passed or not passed since it's creation.RedTestContext.TimingValidator
public boolean isTestActive()
Copyright © 2017. All rights reserved.