new TestContext()
The test context is used for performing test assertions and manage the completion of the test. This context
is provided by vertx-unit as argument of the test case.
- Source:
Methods
-
assertEquals(expected, actual, message) → {TestContext}
-
Assert the
expected
argument is equals to theactual
argument. If the arguments are not equals an assertion error is thrown otherwise the execution continue.Parameters:
Name Type Description expected
Object the object the actual object is supposedly equals to actual
Object the actual object to test message
string the failure message - Source:
Returns:
a reference to this, so the API can be used fluently- Type
- TestContext
-
assertFalse(condition, message) → {TestContext}
-
Assert the specified
condition
isfalse
. If the condition istrue
, an assertion error is thrown otherwise the execution continue.Parameters:
Name Type Description condition
boolean the condition to assert message
string the failure message - Source:
Returns:
a reference to this, so the API can be used fluently- Type
- TestContext
-
assertInRange(expected, actual, delta, message) → {TestContext}
-
Asserts that the
expected
double argument is equals to theactual
double argument within a positive delta. If the arguments do not satisfy this, an assertion error is thrown otherwise the execution continue.Parameters:
Name Type Description expected
number the object the actual object is supposedly equals to actual
number the actual object to test delta
number the maximum delta message
string the failure message - Source:
Returns:
a reference to this, so the API can be used fluently- Type
- TestContext
-
assertNotEquals(first, second, message) → {TestContext}
-
Assert the
first
argument is not equals to thesecond
argument. If the arguments are equals an assertion error is thrown otherwise the execution continue.Parameters:
Name Type Description first
Object the first object to test second
Object the second object to test message
string the failure message - Source:
Returns:
a reference to this, so the API can be used fluently- Type
- TestContext
-
assertNotNull(expected, message) → {TestContext}
-
Assert the
expected
argument is notnull
. If the argument isnull
, an assertion error is thrown otherwise the execution continue.Parameters:
Name Type Description expected
Object the argument being asserted to be not null message
string the failure message - Source:
Returns:
a reference to this, so the API can be used fluently- Type
- TestContext
-
assertNull(expected, message) → {TestContext}
-
Assert the
expected
argument isnull
. If the argument is not, an assertion error is thrown otherwise the execution continue.Parameters:
Name Type Description expected
Object the argument being asserted to be null message
string the failure message - Source:
Returns:
a reference to this, so the API can be used fluently- Type
- TestContext
-
assertTrue(condition, message) → {TestContext}
-
Assert the specified
condition
istrue
. If the condition isfalse
, an assertion error is thrown otherwise the execution continue.Parameters:
Name Type Description condition
boolean the condition to assert message
string the failure message - Source:
Returns:
a reference to this, so the API can be used fluently- Type
- TestContext
-
async() → {Async}
-
Create and returns a new async object, the returned async controls the completion of the test. Calling the Async#complete completes the async operation. The test case will complete when all the async objects have their Async#complete method called at least once. This method shall be used for creating asynchronous exit points for the executed test.
- Source:
Returns:
the async instance- Type
- Async
-
fail(message)
-
Throw a failure with the specified failure
message
.Parameters:
Name Type Description message
string the failure message - Source:
-
get(key) → {Object}
-
Get some data from the context.
Parameters:
Name Type Description key
string the key of the data - Source:
Returns:
the data- Type
- Object
-
put(key, value) → {Object}
-
Put some data in the context.
This can be used to share data between different tests and before/after phases.
Parameters:
Name Type Description key
string the key of the data value
Object the data - Source:
Returns:
the previous object when it exists- Type
- Object
-
remove(key) → {Object}
-
Remove some data from the context.
Parameters:
Name Type Description key
string the key to remove - Source:
Returns:
the removed object when it exists- Type
- Object