Asserter

Common
JVM
JS
Native
1.0
interface Asserter
(source)

Abstracts the logic for performing assertions. Specific implementations of Asserter can use JUnit or TestNG assertion facilities.

Functions

Common
JVM
JS
Native
1.0

assertEquals

Asserts that the specified values are equal.

open fun assertEquals(
    message: String?,
    expected: Any?,
    actual: Any?
): Unit
Common
JVM
JS
Native
1.0

assertNotEquals

Asserts that the specified values are not equal.

open fun assertNotEquals(
    message: String?,
    illegal: Any?,
    actual: Any?
): Unit
Common
JVM
JS
Native
1.0

assertNotNull

Asserts that the specified value is not null.

open fun assertNotNull(message: String?, actual: Any?): Unit
Common
JVM
JS
Native
1.0

assertNotSame

Asserts that the specified values are not the same instance.

open fun assertNotSame(
    message: String?,
    illegal: Any?,
    actual: Any?
): Unit
Common
JVM
JS
Native
1.0

assertNull

Asserts that the specified value is null.

open fun assertNull(message: String?, actual: Any?): Unit
Common
JVM
JS
Native
1.0

assertSame

Asserts that the specified values are the same instance.

open fun assertSame(
    message: String?,
    expected: Any?,
    actual: Any?
): Unit
Common
JVM
JS
Native
1.0

assertTrue

Asserts that the specified value is true.

open fun assertTrue(
    lazyMessage: () -> String?,
    actual: Boolean
): Unit
open fun assertTrue(message: String?, actual: Boolean): Unit
Common
JVM
JS
Native
1.0

fail

Fails the current test with the specified message.

abstract fun fail(message: String?): Nothing

Fails the current test with the specified message and cause exception.

abstract fun fail(
    message: String?,
    cause: Throwable?
): Nothing

Inheritors

Common
JVM
JS
Native
1.0

DefaultAsserter

Default Asserter implementation to avoid dependency on JUnit or TestNG.

object DefaultAsserter : Asserter
JUnit5
1.0

JUnit5Asserter

Implements kotlin.test assertions by delegating them to org.junit.jupiter.api.Assertions class.

object JUnit5Asserter : Asserter
JUnit
1.0

JUnitAsserter

Implements kotlin.test assertions by delegating them to org.junit.Assert class.

object JUnitAsserter : Asserter
TestNG
1.0

TestNGAsserter

Implements kotlin.test assertions by delegating them to org.testng.Assert class.

object TestNGAsserter : Asserter