Provides interaction with asynchronous test executor.

General test procedure within test function is:

  1. Perform the testing. Notify test executor on failures or successes. Several notifications are allowed. Each failure or success notification is represented as test variant.
  2. Notify test executor on test procedure completion (call complete()). This step is nesseccary to continue testing with next execution since test executor blocks execution thread until complete() is called.

Example of tested function:

test async
void doTesting(AsyncTestContext context) {
    // perform test procedure and notify about fails, if no fails notified test is considered successfull
    context.fail(Exception("exception"), "some exception");
    context.fail(AssertionError( "assert"), "some assert");
    context.assertThat(true, IsFalse(), "to be `false`");

    // complete testing
    context.complete("title which is added to test variant name only if test is succeeded");
}

It is not required to notify with success, if test function doesn't notify on failure the test is considered as successfull.

By: Lis
Since 0.0.1

no type hierarchy

no supertypes hierarchy

no subtypes hierarchy

Inherited Attributes
Attributes inherited from: Object
hash, string
Methods
assertThatshared default void assertThat<Value>(Value|Value() source, Matcher<Value> matcher, String title = "", Boolean reportSuccess = false)

Fails the test if source doesn't match matcher or succeeds the test otherwise.
If value source function throws corresponding failure is reported.

Parameters:
  • source

    Value source: value itself or function returned value to be matched.

  • matcher

    Verifies if the value matches expectations.

  • title = ""

    Optional title to be shown within test name.

  • reportSuccess = false

    If true reports on failures and successes. Otherwise reportes only on failures.
    Default is false.

Since 0.4.0
assertThatExceptionshared default void assertThatException(Throwable|Anything() source, Matcher<Throwable> matcher, String title = "", Boolean reportSuccess = false)

Fails the test if a given exception doesn't match matcher or succeeds the test otherwise.
The exception source may be an exception itself or function throwing an exception.

Parameters:
  • source

    Exception source: exception itself or function throwing exception.

  • matcher

    Verifies if the exception matches expectations.

  • title = ""

    Optional title to be shown within test name.

  • reportSuccess = false

    If true reports on failures and successes. Otherwise reportes only on failures.

Since 0.6.0
assertThatExceptionListenershared default void assertThatExceptionListener(Matcher<Throwable> matcher, String title = "", Boolean reportSuccess = false)(Throwable|Anything() source)

Similar to assertThatException() but instantiates a listener on exception to be matched.

Parameters:
  • matcher

    Verifies if the exception matches expectations.

  • title = ""

    Optional title to be shown within test name.

  • reportSuccess = false

    If true reports on failures and successes. Otherwise reportes only on failures.

  • source

    Exception source: exception itself or function throwing exception.

Since 0.6.0
assertThatListenershared default void assertThatListener<Value>(Matcher<Value> matcher, String title = "", Boolean reportSuccess = false)(Value|Value() source)

Similar to assertThat() but instantiates a listener on value to be matched.

Parameters:
  • matcher

    Verifies if the value matches expectations.

  • title = ""

    Optional title to be shown within test name.

  • reportSuccess = false

    If true reports on failures and successes. Otherwise reportes only on failures.

  • source

    Value source: value itself or function returned value to be matched.

Since 0.6.0
completeshared formal void complete(String title = "")

Completes the testing. To be called by the test function when testing is completed. This wakes up test thread and allows to continue testing and store results.

Parameters:
  • title = ""

    Optional title which is added to test variant name only if test is succeeded.

failshared formal void fail(Throwable|Anything() exceptionSource, String title = "")

Fails the test with either AssertionError or Exception.

Parameters:
  • exceptionSource

    Reason fails this test or a function which throws either AssertionError or Exception. If the function doesn't throw no any message is reported.

  • title = ""

    Optional title to be shown within test name.

succeedshared formal void succeed(String message)

Succeeds the test with the given message.

Parameters:
  • message

    Success message.

Inherited Methods
Methods inherited from: Object
equals