TestMosaic

A test wrapper around Mosaic that provides assertion methods for testing Tile implementations.

This class is the main entry point for writing tests with Mosaic. It extends the standard Mosaic functionality with testing-specific methods and assertions.

This class should be built using TestMosaicBuilder for advanced usage.

val testMosaic = TestMosaicBuilder(testScope)
.withMockTile(DependencyTile, expectedDependency)
.build()
testMosaic.assertEquals(ResponseTile, expectedResponse)

Inherited properties

Link copied to clipboard
open override val canvas: Canvas
Link copied to clipboard

Functions

Link copied to clipboard
suspend fun <V> assertEquals(tile: Tile<V>, expected: V)

Asserts that a Tile returns the expected value.

suspend fun <K : Any, V> assertEquals(tile: MultiTile<K, V>, keys: Collection<K>, expected: Map<K, V>)

Asserts that a MultiTile returns the expected values for the given keys.

suspend fun <V> assertEquals(tile: Tile<V>, expected: V, message: String)

Asserts that a Tile returns the expected value with a custom failure message.

suspend fun <K : Any, V> assertEquals(tile: MultiTile<K, V>, keys: List<K>, expected: Map<K, V>, message: String)

Asserts that a MultiTile returns the expected values for the given keys with a custom failure message.

Link copied to clipboard
suspend fun assertThrows(tile: Tile<*>, expectedException: KClass<out Throwable>): Throwable

Asserts that a Tile throws the expected exception when retrieved.

suspend fun <K : Any> assertThrows(tile: MultiTile<K, *>, keys: List<K>, expectedException: KClass<out Throwable>): Throwable

Asserts that a MultiTile throws the expected exception when retrieved with the given keys.

suspend fun assertThrows(tile: Tile<*>, expectedException: KClass<out Throwable>, message: String): Throwable

Asserts that a Tile throws the expected exception with a custom failure message.

Link copied to clipboard
open suspend override fun <V> compose(tile: Tile<V>): V
Link copied to clipboard
open override fun <V> composeAsync(tile: Tile<V>): Deferred<V>
open override fun <K : Any, V> composeAsync(tile: MultiTile<K, V>, keys: Collection<K>): Map<K, Deferred<V>>

Inherited functions

Link copied to clipboard
open suspend fun <K : Any, V> compose(tile: MultiTile<K, V>, key: K): V
open suspend fun <K : Any, V> compose(tile: MultiTile<K, V>, keys: Collection<K>): Map<K, V>
Link copied to clipboard
open fun <K : Any, V> composeAsync(tile: MultiTile<K, V>, key: K): Deferred<V>