From b406d2b5d478794b7a2141a9cc1abb2b0b5c1e03 Mon Sep 17 00:00:00 2001
From: Kihong Seong <kihongs@google.com>
Date: Tue, 7 Feb 2023 05:28:41 +0000
Subject: [PATCH] Disable MapClientContentTest when sms is not supported

Bug: 266850093
Test: atest BluetoothInstrumentationTests
Change-Id: I54b0eee80fb856c63c454c0076ec57ee0d17555b
---
 .../android/bluetooth/mapclient/MapClientContentTest.java    | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/android/app/tests/unit/src/com/android/bluetooth/mapclient/MapClientContentTest.java b/android/app/tests/unit/src/com/android/bluetooth/mapclient/MapClientContentTest.java
index 0970dfa709a..a8a40626ac2 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/mapclient/MapClientContentTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/mapclient/MapClientContentTest.java
@@ -37,6 +37,7 @@ import android.os.Bundle;
 import android.os.Handler;
 import android.provider.Telephony.Mms;
 import android.provider.Telephony.Sms;
+import android.telephony.SmsManager;
 import android.telephony.SubscriptionInfo;
 import android.telephony.SubscriptionManager;
 import android.test.mock.MockContentProvider;
@@ -55,6 +56,7 @@ import com.android.vcard.VCardProperty;
 
 import org.junit.After;
 import org.junit.Assert;
+import org.junit.Assume;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -107,6 +109,7 @@ public class MapClientContentTest {
     private FakeContentProvider mMockSmsContentProvider;
     private FakeContentProvider mMockMmsContentProvider;
     private FakeContentProvider mMockThreadContentProvider;
+    private SmsManager mSmsManager = SmsManager.getDefault();
 
     @Mock
     private SubscriptionManager mMockSubscriptionManager;
@@ -115,6 +118,8 @@ public class MapClientContentTest {
 
     @Before
     public void setUp() throws Exception {
+        // Do not run test if sms is not supported
+        Assume.assumeTrue(mSmsManager.isImsSmsSupported());
         MockitoAnnotations.initMocks(this);
         mTargetContext = InstrumentationRegistry.getTargetContext();
 
-- 
GitLab