I thought that exceptions have to be thrown. In my...
# announcements
m
I thought that exceptions have to be thrown. In my case I have a test and when I create an exception it is thrown automatically and I don’t understand, why:
Copy code
class RuntimeExceptionMapperTest :  StringSpec() {
    init {
        val mapper = RuntimeExceptionMapper()
        "ConcurrentModificationException should be mapped to CONFLICT (409)" {
            val e = ConcurrentModificationException("Test") // throws exception - why?
            mapper.toResponse(e).status shouldBe CONFLICT.statusCode
        }
    }
}
I use Kotlin 1.2.10 with KotlinTest 2.0.7 and have no idea, why the exception is thrown. I just want to create an exception object, not throwing it…
k
exceptions aren't thrown by themselves. something different must be going on in your code