assertk icon indicating copy to clipboard operation
assertk copied to clipboard

Specify failures throw AssertionError in unit tests

Open dzirbel opened this issue 3 years ago • 0 comments

Unit tests could be strengthened by checking the exception type thrown by assertion failures to be AssertionError. This would avoid issues like #409 where the wrong type of exception was thrown, but unit tests were still satisfied.

This is likely as simple as replacing

assertFails { ... }

with

assertFailsWith(AssertionError::class) { ... }

but could also be extracted into a separate utility function.

dzirbel avatar Mar 18 '22 21:03 dzirbel