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
expectedargument is equals to theactualargument. If the arguments are not equals an assertion error is thrown otherwise the execution continue.Parameters:
Name Type Description expectedObject the object the actual object is supposedly equals to actualObject the actual object to test messagestring 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
conditionisfalse. If the condition istrue, an assertion error is thrown otherwise the execution continue.Parameters:
Name Type Description conditionboolean the condition to assert messagestring 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
expecteddouble argument is equals to theactualdouble 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 expectednumber the object the actual object is supposedly equals to actualnumber the actual object to test deltanumber the maximum delta messagestring 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
firstargument is not equals to thesecondargument. If the arguments are equals an assertion error is thrown otherwise the execution continue.Parameters:
Name Type Description firstObject the first object to test secondObject the second object to test messagestring the failure message - Source:
Returns:
a reference to this, so the API can be used fluently- Type
- TestContext
-
assertNotNull(expected, message) → {TestContext}
-
Assert the
expectedargument is notnull. If the argument isnull, an assertion error is thrown otherwise the execution continue.Parameters:
Name Type Description expectedObject the argument being asserted to be not null messagestring the failure message - Source:
Returns:
a reference to this, so the API can be used fluently- Type
- TestContext
-
assertNull(expected, message) → {TestContext}
-
Assert the
expectedargument isnull. If the argument is not, an assertion error is thrown otherwise the execution continue.Parameters:
Name Type Description expectedObject the argument being asserted to be null messagestring 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
conditionistrue. If the condition isfalse, an assertion error is thrown otherwise the execution continue.Parameters:
Name Type Description conditionboolean the condition to assert messagestring 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(cause)
-
Throw a failure with the specified failure
cause.Parameters:
Name Type Description causetodo the failure cause - Source:
-
get(key) → {Object}
-
Get some data from the context.
Parameters:
Name Type Description keystring 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 keystring the key of the data valueObject 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 keystring the key to remove - Source:
Returns:
the removed object when it exists- Type
- Object