withCustomTile
Adds a mock Tile with custom behavior.
Return
This builder for method chaining
val testMosaic = mosaicBuilder()
.withCustomTile(MyTile) {
// Custom logic here
if (condition) "result1" else "result2"
}
.build()Content copied to clipboard
Parameters
tile
The Tile to mock
provider
A suspending lambda that provides the response
Type Parameters
V
The type of data the tile returns
fun <K : Any, V> withCustomTile(tile: MultiTile<K, V>, provider: suspend Mosaic.(Set<K>) -> Map<K, V>): TestMosaicBuilder(source)
Adds a mock MultiTile with custom behavior.
Return
This builder for method chaining
val testMosaic = mosaicBuilder()
.withCustomTile(UserTile) { keys ->
// Custom logic based on requested keys
keys.associateWith { key ->
if (key.startsWith("admin")) createAdminUser(key)
else createRegularUser(key)
}
}
.build()Content copied to clipboard
Parameters
tile
The MultiTile to mock
provider
A suspending lambda that provides responses based on requested keys
Type Parameters
K
The type of keys in the response
V
The type of values in the response