Question: In Java, the programmer can specify expected exceptions for JUnit test cases like this:

```
@Test(expected = ArithmeticException.class)
public void omg()
{
    int blackHole = 1 / 0;
}

```

How would I do this in Kotlin? I have tried two syntax variations, but none of them worked:

```
import org.junit.Test

// ...

@Test(expected = ArithmeticException) fun omg()
    Please specify constructor invocation;
    classifier 'ArithmeticException' does not have a companion object

@Test(expected = ArithmeticException.class) fun omg()
                            name expected ^
                                            ^ expected ')'

```

Answer: 
You can use [Kotest](https://github.com/kotest/kotest) for this.

In your test, you can wrap arbitrary code with a shouldThrow block:

```
shouldThrow<ArithmeticException> {
  // code in here that you expect to throw a ArithmeticException
}

```
org.junit.jupiter.api.Assertions.kt
-----------------------------------

```
/**
 * Example usage:
 * ```kotlin
 * val exception = assertThrows<IllegalArgumentException>("Should throw an Exception") {
 *     throw IllegalArgumentException("Talk to a duck")
 * }
 * assertEquals("Talk to a duck", exception.message)
 * ```
 * @see Assertions.assertThrows
 */
inline fun <reified T : Throwable> assertThrows(message: String, noinline executable: () -> Unit): T =
        assertThrows({ message }, executable)

```