Force the last five failure branches
The previous commit called five branches unforceable. That was wrong on all five, and the reasoning behind it was lazy rather than investigated. Three were described as needing a SAF grant revoked mid-job. They do not: a content URI whose authority does not exist reaches exactly the same null branch as one whose permission was withdrawn, and constructing one is a single line. That now covers the conversion input, the join inputs, and the publish destination. One was described as unreachable through ConcatWorker.request(). True, but irrelevant -- a worker is just input Data, and WorkManager will run one built without the input array. That is also what a version-skewed queue entry would look like after an app update, so it is worth covering rather than dismissing. One was described as Media3-internal. An output path whose parent directory does not exist makes Transformer.start() fail synchronously, and the engine has to surface that as a rejected suspension. The test asserts specifically that it is not a timeout: hanging would be far worse than throwing, because the worker would sit holding a foreground service indefinitely. The assertions check outcomes rather than exception types. Whether a resolver returns null or throws is a provider implementation detail; what matters is that the job fails cleanly and carries a message, instead of taking down the worker. Every failure branch in the conversion and join paths is now forced. 40 instrumented tests on a Pixel 10 Pro XL and 66 unit tests, 0 failures, with the only skips being the opt-in benchmark. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -41,8 +41,13 @@ interface SoftwareTranscoder {
|
||||
* test run — and they are also the ones a user meets on a bad day, so leaving them
|
||||
* unexercised means the error handling is the least-tested code in the app.
|
||||
*
|
||||
* Tests must call [reset] afterwards; [dev.jasonmross.mediaconverter.convert.FakeFailures]
|
||||
* Tests must call [reset] afterwards; `FakeFailures` in the androidTest source set
|
||||
* does that for them.
|
||||
*
|
||||
* Every failure branch in the conversion and join paths is now forced by a test. The
|
||||
* three that needed a seam are covered here; the rest are reachable directly, either
|
||||
* with a content URI pointing at a provider that does not exist, or by constructing a
|
||||
* worker's input Data by hand rather than through its request() helper.
|
||||
*/
|
||||
object ConversionDependencies {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user