-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Labels
Description
Consider the following test case:
class ExceptionTest {
@Test
fun `should preserve exception message`() {
Assertions.assertThatThrownBy {
runBlocking {
withContext(newFixedThreadPoolContext(10, "my-context")) {
throw MyTokenException("42")
}
}
}.isInstanceOf(MyTokenException::class.java).hasMessage("Token 42 is not valid")
}
}
class MyTokenException(token: String) : RuntimeException("Token $token is not valid")
It is failing on message assertion:
Expecting message to be:
<"Token 42 is not valid">
but was:
<"Token Token 42 is not valid is not valid">
It looks like recoverStackTrace / tryCopyException
incorrectly recovers the exception. #1040 mentions that similar problem is fixed in 1.2.0, but this test fails on 1.3.2.