I am trying to write a test in Kotlin that makes sure an unchecked exception is thrown in specific circumstances. I am trying to use org.junit.jupiter.api.Assertions.assertThrows like this:
assertThrows(MyRuntimeException::class, Executable { myMethodThatThrowsThatException() })
when i try this i get a Type inference failed compiler error. Is there any good way to test this behavior without doing the naive try catch?
Aucun commentaire:
Enregistrer un commentaire