assertTrue

fun <E : KoBaseProvider> E?.assertTrue(strict: Boolean = false, additionalMessage: String? = null, testName: String? = null, function: (E) -> Boolean?)

Asserts that element match the specified predicate.

Parameters

strict

A flag indicating whether strict checking should be enabled. If set to true, an assertion error will be thrown if assert is called on null. If set to false, the method will pass successfully when called on null. By default, false.

additionalMessage

An optional message to provide additional context when the assertion fails. This message will be included in the assertion error if the assertion fails.

testName

An optional test name recommended for Kotest tests. By default, test name is derived from JUnit method name, however for Kotest framework it must be manually specified to be displayed in error messages and enable suppression.

function

The predicate function that takes an element of type E and returns a Boolean value. If the function returns true, the element is considered valid; otherwise, it's considered invalid.


fun <E : KoBaseProvider> List<E?>.assertTrue(strict: Boolean = false, additionalMessage: String? = null, testName: String? = null, function: (E) -> Boolean?)

Asserts that all elements in the list match the specified predicate.

Parameters

strict

A flag indicating whether strict checking should be enabled. If set to true, an assertion error will be thrown if the declaration list is empty or contains only null values. If set to false, the method will pass successfully when called on an empty list. By default, false.

additionalMessage

An optional message to provide additional context when the assertion fails. This message will be included in the assertion error if the assertion fails.

testName

An optional test name recommended for Kotest tests. By default, test name is derived from JUnit method name, however for Kotest framework it must be manually specified to be displayed in error messages and enable suppression.

function

The predicate function that takes an element of type E and returns a Boolean value. If the function returns true, the element is considered valid; otherwise, it's considered invalid.


fun <E : KoBaseProvider> Sequence<E?>.assertTrue(strict: Boolean = false, additionalMessage: String? = null, testName: String? = null, function: (E) -> Boolean?)

Asserts that all elements in the sequence match the specified predicate.

Parameters

strict

A flag indicating whether strict checking should be enabled. If set to true, an assertion error will be thrown if the sequence is empty or contains only null values. If set to false, the method will pass successfully when called on an empty sequence. By default, false.

additionalMessage

An optional message to provide additional context when the assertion fails. This message will be included in the assertion error if the assertion fails.

testName

An optional test name recommended for Kotest tests. By default, test name is derived from JUnit method name, however for Kotest framework it must be manually specified to be displayed in error messages and enable suppression.

function

The predicate function that takes an element of type E and returns a Boolean value. If the function returns true, the element is considered valid; otherwise, it's considered invalid.