You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently if some code wants to handle assertion failures, this doesn't work for strikt helpers like first() because MappingException extends IncompleteExecutionException, not AssertionError. eg:
privateval failures = mutableListOf<AssertionError>()
fundoSomethingWithFailures(runnable:Runnable) {
try {
runnable.run()
} catch(assertionFailed:AssertionError) {
failures.add(assertionFailed)
throw assertionFailed
}
}
privatefunthingUnderTest() = emptyList<String>()
// failure will be added to failures
@Test
fun`thingUnderTest has a catflap`() {
doSomethingWithFailures {
expectThat(thingUnderTest()).contains("catflap")
}
}
// failure will not be added to failures
@Test
fun`thingUnderTest has a catflap first`() {
doSomethingWithFailures {
expectThat(thingUnderTest()).first().isEqualTo("catflap")
}
}
Would it be better to have MappingException extend org.opentest4j.AssertionFailedError instead?
The text was updated successfully, but these errors were encountered:
robd
changed the title
Should MappingFailed extent AssertionFailedError?
Should MappingFailed extend AssertionFailedError?
Jun 9, 2022
Currently if some code wants to handle assertion failures, this doesn't work for strikt helpers like
first()
becauseMappingException
extendsIncompleteExecutionException
, notAssertionError
. eg:Would it be better to have
MappingException
extendorg.opentest4j.AssertionFailedError
instead?The text was updated successfully, but these errors were encountered: