Stronger lambda error (#4771)
* Make sure lambdaError() make the test fail in all circumstances. * Fix existing errors on tests. * Uniformize the way we are creating class under test. * Cleanup * Fix typo * Fix failing test after rebase.
This commit is contained in:
parent
5b9da3c41b
commit
4572419ed2
19 changed files with 289 additions and 279 deletions
|
|
@ -7,8 +7,19 @@
|
|||
|
||||
package io.element.android.tests.testutils.lambda
|
||||
|
||||
import kotlin.system.exitProcess
|
||||
|
||||
fun lambdaError(
|
||||
message: String = "This lambda should never be called."
|
||||
): Nothing {
|
||||
throw AssertionError(message)
|
||||
// Throwing an exception here is not enough, it can be caught.
|
||||
// Instead exit the process to make sure the test fails.
|
||||
// The error will be:
|
||||
// "Could not stop all services."
|
||||
// In this case, put a breakpoint here and run the test in debug mode to identify which lambda is failing.
|
||||
System.err.println(message)
|
||||
Thread.currentThread().stackTrace.forEach {
|
||||
System.err.println(it)
|
||||
}
|
||||
exitProcess(1)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue