From 74eddc5490edcccdb5c95e33ade0b7657a601cde Mon Sep 17 00:00:00 2001 From: Vadim Tryshev Date: Mon, 14 Aug 2023 10:39:56 -0700 Subject: [PATCH] Improving diagnostics for tests ignored due to @Stability annotation Now they will be shown as ignored, not as passed. Bug: 187761685 Flag: N/A Test: presubmit Change-Id: I0913577230441c6bd60165138455ea16a759b39b --- .../launcher3/util/rule/TestStabilityRule.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/tests/src/com/android/launcher3/util/rule/TestStabilityRule.java b/tests/src/com/android/launcher3/util/rule/TestStabilityRule.java index f33a50ae5a..38de07192a 100644 --- a/tests/src/com/android/launcher3/util/rule/TestStabilityRule.java +++ b/tests/src/com/android/launcher3/util/rule/TestStabilityRule.java @@ -17,6 +17,8 @@ package com.android.launcher3.util.rule; import static androidx.test.InstrumentationRegistry.getInstrumentation; +import static org.junit.Assume.assumeTrue; + import android.content.pm.PackageManager; import android.os.Build; import android.util.Log; @@ -69,12 +71,9 @@ public class TestStabilityRule implements TestRule { return new Statement() { @Override public void evaluate() throws Throwable { - if ((stability.flavors() & getRunFlavor()) != 0) { - Log.d(TAG, "Running " + description.getDisplayName()); - base.evaluate(); - } else { - Log.d(TAG, "Skipping " + description.getDisplayName()); - } + assumeTrue("Ignoring the test due to @Stability annotation", + (stability.flavors() & getRunFlavor()) != 0); + base.evaluate(); } }; } else {