Support multiple cleanup blocks in tryTest{}
This is useful for some tests that need to make sure a few
things all happen, but some of them may throw an exception.
In vanilla Java you'd say
try {
...
} finally {
try {
...
} finally {
try {
...
} finally {
...
}
}
}
With this patch, you can pass a list of blocks to clean.
Kotlin :
tryTest {
...
} cleanupStep {
...
} cleanupStep {
...
} cleanup {
...
}
Java :
tryAndCleanup(() -> {
...
}, () -> {
...
}, () -> {
...
})
This keeps the semantics of tryTest{} of throwing any
exception that was thrown in tryTest{} and adding the
exception in the cleanup steps as suppressed.
Test: new tests for this
Change-Id: Ie26b802cb4893e13a70646aa0b7887701dee1ec6
3 files changed
tree: cfd499e385a8ad7b3f93b7d91131beac7c69abbd
- staticlibs/