assertEquals

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

Asserts that a Tile returns the expected value.

Parameters

tile

The tile to test

expected

The expected value

Type Parameters

V

The type of value the tile returns

Throws

if the actual value doesn't match the expected value

testMosaic.assertEquals(MyTile, "expected value")

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

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

Parameters

tile

The tile to test

expected

The expected value

message

The message to include in case of assertion failure

Type Parameters

V

The type of value the tile returns

Throws

if the actual value doesn't match the expected value

testMosaic.assertEquals(
tile = MyTile,
expected = "expected value",
message = "The tile did not return the expected value"
)

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

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

Parameters

tile

The tile to test

keys

The list of keys to request from the tile

expected

The expected map of keys to values

Type Parameters

K

The type of keys in the response map

V

The type of values in the response map

Throws

if the actual values don't match the expected values

testMosaic.assertEquals(
tile = UserTile,
keys = listOf("user1", "user2"),
expected = mapOf("user1" to User("user1"), "user2" to User("user2"))
)

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

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

Parameters

tile

The tile to test

keys

The list of keys to request from the tile

expected

The expected map of keys to values

message

The message to include in case of assertion failure

Type Parameters

K

The type of keys in the response map

V

The type of values in the response map

Throws

if the actual values don't match the expected values

testMosaic.assertEquals(
tile = UserTile,
keys = listOf("user1", "user2"),
expected = mapOf("user1" to User("user1"), "user2" to User("user2")),
message = "User data does not match expected values"
)