Handling exceptions in tests: Junit & Kotest

Exceptions and throwables are essential part of many Java APIs. They are useful for modeling application domain layer and controlling program execution flow. We’ll be working on following piece of code: class CustomException : Exception()class SystemUnderTest { fun doStuff() { throw CustomException() }} Annotated Junit4 method class AssertionsOnExceptionsTest { @Test(expected = CustomException::class) fun `it should …

Handling exceptions in tests: Junit & Kotest Read More »