vertx / io.vertx.rxjava.ext.unit / TestContext

TestContext

open class 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. NOTE: This class has been automatically generated from the io.vertx.ext.unit.TestContext non RX-ified interface using Vert.x codegen.

Constructors

<init>

TestContext(delegate: TestContext)

Properties

__TYPE_ARG

static val __TYPE_ARG: TypeArg<TestContext>

Functions

assertEquals

open fun assertEquals(expected: Any, actual: Any): TestContext
open fun assertEquals(expected: Any, actual: Any, message: String): TestContext

Assert the expected argument is equals to the actual argument. If the arguments are not equals an assertion error is thrown otherwise the execution continue.

assertFalse

open fun assertFalse(condition: Boolean): TestContext
open fun assertFalse(condition: Boolean, message: String): TestContext

Assert the specified condition is false. If the condition is true, an assertion error is thrown otherwise the execution continue.

assertInRange

open fun assertInRange(expected: Double, actual: Double, delta: Double): TestContext
open fun assertInRange(expected: Double, actual: Double, delta: Double, message: String): TestContext

Asserts that the expected double argument is equals to the actual double argument within a positive delta. If the arguments do not satisfy this, an assertion error is thrown otherwise the execution continue.

assertNotEquals

open fun assertNotEquals(first: Any, second: Any): TestContext
open fun assertNotEquals(first: Any, second: Any, message: String): TestContext

Assert the first argument is not equals to the second argument. If the arguments are equals an assertion error is thrown otherwise the execution continue.

assertNotNull

open fun assertNotNull(expected: Any): TestContext
open fun assertNotNull(expected: Any, message: String): TestContext

Assert the expected argument is not null. If the argument is null, an assertion error is thrown otherwise the execution continue.

assertNull

open fun assertNull(expected: Any): TestContext
open fun assertNull(expected: Any, message: String): TestContext

Assert the expected argument is null. If the argument is not, an assertion error is thrown otherwise the execution continue.

assertTrue

open fun assertTrue(condition: Boolean): TestContext
open fun assertTrue(condition: Boolean, message: String): TestContext

Assert the specified condition is true. If the condition is false, an assertion error is thrown otherwise the execution continue.

async

open fun async(): Async

Create and returns a new async object, the returned async controls the completion of the test. Calling the io.vertx.rxjava.ext.unit.Async#complete completes the async operation. The test case will complete when all the async objects have their io.vertx.rxjava.ext.unit.Async#complete method called at least once. This method shall be used for creating asynchronous exit points for the executed test.

open fun async(count: Int): Async

Create and returns a new async object, the returned async controls the completion of the test. This async operation completes when the io.vertx.rxjava.ext.unit.Async#complete is called count times. The test case will complete when all the async objects have their io.vertx.rxjava.ext.unit.Async#complete method called at least once. This method shall be used for creating asynchronous exit points for the executed test.

asyncAssertFailure

open fun <T : Any> asyncAssertFailure(): Handler<AsyncResult<T>>
open fun <T : Any> asyncAssertFailure(causeHandler: Handler<Throwable>): Handler<AsyncResult<T>>

Creates and returns a new async handler, the returned handler controls the completion of the test. When the returned handler is called back with a failed result it completes the async operation. When the returned handler is called back with a succeeded result it fails the test.

asyncAssertSuccess

open fun <T : Any> asyncAssertSuccess(): Handler<AsyncResult<T>>

Creates and returns a new async handler, the returned handler controls the completion of the test. When the returned handler is called back with a succeeded result it completes the async operation. When the returned handler is called back with a failed result it fails the test with the cause of the failure.

open fun <T : Any> asyncAssertSuccess(resultHandler: Handler<T>): Handler<AsyncResult<T>>

Creates and returns a new async handler, the returned handler controls the completion of the test. When the returned handler is called back with a succeeded result it invokes the resultHandler argument with the async result. The test completes after the result handler is invoked and does not fails. When the returned handler is called back with a failed result it fails the test with the cause of the failure. Note that the result handler can create other async objects during its invocation that would postpone the completion of the test case until those objects are resolved.

equals

open fun equals(other: Any?): Boolean

exceptionHandler

open fun exceptionHandler(): Handler<Throwable>

fail

open fun fail(): Unit

Throw a failure.

open fun fail(message: String): Unit

Throw a failure with the specified failure message.

open fun fail(cause: Throwable): Unit

Throw a failure with the specified failure cause.

get

open fun <T : Any> get(key: String): T

Get some data from the context.

getDelegate

open fun getDelegate(): TestContext

hashCode

open fun hashCode(): Int

newInstance

open static fun newInstance(arg: TestContext): TestContext

put

open fun <T : Any> put(key: String, value: Any): T

Put some data in the context.

This can be used to share data between different tests and before/after phases.

remove

open fun <T : Any> remove(key: String): T

Remove some data from the context.

toString

open fun toString(): String