Multiplatform testing


In JUnit I have the option to pass an expected exception to the Test annotation. How would I do this in the multi platform environment?

The only test annotation is defined like this

public expect annotation class Test()

I could not find anything related to multi-platform about this.


You can use assertFailsWith function to assert that a code block throws an exception:

fun myTest() {
    assertFailsWith<IndexOutOfBoundsException> { list[-1] }