Commit 0b249779 by andrewlewis Committed by Andrew Lewis

Interrupt the test thread for uncaught errors

This makes assertion errors in code running on the Looper less easy to miss.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=184294290
parent 451721d4
......@@ -117,7 +117,14 @@ public final class RobolectricUtil {
}
}
if (!isRemoved) {
target.dispatchMessage(pendingMessage.message);
try {
target.dispatchMessage(pendingMessage.message);
} catch (Throwable t) {
// Interrupt the main thread to terminate the test. Robolectric's HandlerThread will
// print the rethrown error to standard output.
Looper.getMainLooper().getThread().interrupt();
throw t;
}
}
}
if (Util.SDK_INT >= 21) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment