From e4d7e5e7f55aad556dac81fb90a7eb76f42849b0 Mon Sep 17 00:00:00 2001 From: samrobinson Date: Mon, 11 Apr 2022 19:41:16 +0100 Subject: [PATCH] Allow suppression of AssertionError in TransformerAndroidTestRunner. PiperOrigin-RevId: 440952335 --- .../transformer/TransformerAndroidTestRunner.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/library/transformer/src/androidTest/java/com/google/android/exoplayer2/transformer/TransformerAndroidTestRunner.java b/library/transformer/src/androidTest/java/com/google/android/exoplayer2/transformer/TransformerAndroidTestRunner.java index 77977da7a0..c04019cc1e 100644 --- a/library/transformer/src/androidTest/java/com/google/android/exoplayer2/transformer/TransformerAndroidTestRunner.java +++ b/library/transformer/src/androidTest/java/com/google/android/exoplayer2/transformer/TransformerAndroidTestRunner.java @@ -94,8 +94,8 @@ public class TransformerAndroidTestRunner { } /** - * Sets whether the runner should suppress any {@link Exception} that occurs as a result of - * post-transformation analysis, such as SSIM calculation. + * Sets whether to suppress failures that occurs as a result of post-transformation analysis, + * such as SSIM calculation. * *

Regardless of this value, analysis exceptions are attached to the analysis file. * @@ -294,13 +294,17 @@ public class TransformerAndroidTestRunner { // calculation, so it should be thrown, rather than processed as part of the // TransformationTestResult. throw interruptedException; - } catch (Exception analysisException) { - // Catch all (checked and unchecked) exceptions throw by the SsimHelper and process them as + } catch (Throwable analysisFailure) { + // Catch all (checked and unchecked) failures throw by the SsimHelper and process them as // part of the TransformationTestResult. + Exception analysisException = + analysisFailure instanceof Exception + ? (Exception) analysisFailure + : new IllegalStateException(analysisFailure); + resultBuilder.setAnalysisException(analysisException); Log.e(TAG_PREFIX + testId, "SSIM calculation failed.", analysisException); } - return resultBuilder.build(); } }