aboutsummaryrefslogtreecommitdiff
path: root/robolectric/src/test/java/org/robolectric/shadows/ShadowTelephonyManagerTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'robolectric/src/test/java/org/robolectric/shadows/ShadowTelephonyManagerTest.java')
-rw-r--r--robolectric/src/test/java/org/robolectric/shadows/ShadowTelephonyManagerTest.java12
1 files changed, 11 insertions, 1 deletions
diff --git a/robolectric/src/test/java/org/robolectric/shadows/ShadowTelephonyManagerTest.java b/robolectric/src/test/java/org/robolectric/shadows/ShadowTelephonyManagerTest.java
index 5f6d6b885..cb6359f8e 100644
--- a/robolectric/src/test/java/org/robolectric/shadows/ShadowTelephonyManagerTest.java
+++ b/robolectric/src/test/java/org/robolectric/shadows/ShadowTelephonyManagerTest.java
@@ -33,6 +33,7 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThrows;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.reset;
@@ -45,6 +46,7 @@ import static org.robolectric.Shadows.shadowOf;
import static org.robolectric.shadows.ShadowTelephonyManager.createTelephonyDisplayInfo;
import android.content.ComponentName;
+import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Build.VERSION;
@@ -962,7 +964,7 @@ public class ShadowTelephonyManagerTest {
@Test
@Config(minSdk = S)
public void setCallComposerStatus() {
- ShadowTelephonyManager.setCallComposerStatus(CALL_COMPOSER_STATUS_ON);
+ telephonyManager.setCallComposerStatus(CALL_COMPOSER_STATUS_ON);
assertThat(telephonyManager.getCallComposerStatus()).isEqualTo(CALL_COMPOSER_STATUS_ON);
}
@@ -1030,4 +1032,12 @@ public class ShadowTelephonyManagerTest {
assertThat(shadowOf(telephonyManager).getVisualVoicemailSmsFilterSettings()).isNull();
}
+
+ @Test
+ @Config(minSdk = Q)
+ public void isEmergencyNumber_telephonyServiceUnavailable_throwsIllegalStateException() {
+ ShadowServiceManager.setServiceAvailability(Context.TELEPHONY_SERVICE, false);
+
+ assertThrows(IllegalStateException.class, () -> telephonyManager.isEmergencyNumber("911"));
+ }
}