Open swankjesse opened 7 months ago
This PR migrated about 500 exception tests in OkHttp from this form:
try { doThing() fail() } catch (expected: SomeSpecificExceptionType) { }
to this form:
assertFailsWith<SomeSpecificExceptionType> { doThing() }
I had to use kotlin.test’s assertFailsWith() even though I generally prefer assertk’s APIs, because assertk doesn’t have a function that lets me expect a failure of a specific type in one go.
I know I could have done this:
assertFailure { doThing() }.isInstanceOf<SomeSpecificExceptionType>()
But it’s more code, and I’m in the code deleting business.
This PR migrated about 500 exception tests in OkHttp from this form:
to this form:
I had to use kotlin.test’s assertFailsWith() even though I generally prefer assertk’s APIs, because assertk doesn’t have a function that lets me expect a failure of a specific type in one go.
I know I could have done this:
But it’s more code, and I’m in the code deleting business.