• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2009 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.telephonytest.unit;
18 import android.test.AndroidTestCase;
19 import android.test.suitebuilder.annotation.SmallTest;
20 import android.util.Log;
21 
22 import android.telephony.PhoneNumberUtils;
23 import android.telephony.TelephonyManager;
24 
25 /*
26  * Check the PhoneNumberUtils utility class works as expected.
27  *
28  */
29 
30 public class PhoneNumberUtilsUnitTest extends AndroidTestCase {
31     private String mVoiceMailNumber;
32     private static final String TAG = "PhoneNumberUtilsUnitTest";
33 
34     @Override
setUp()35     protected void setUp() throws Exception {
36         super.setUp();
37         // FIXME: Why are we getting a security exception here? The
38         // permission is declared in the manifest....
39         // mVoiceMailNumber = TelephonyManager.getDefault().getVoiceMailNumber();
40     }
41 
42     @Override
tearDown()43     protected void tearDown() throws Exception {
44         super.tearDown();
45     }
46 
47     /**
48      * Basic checks for the VoiceMail number.
49      * Assumes READ_PHONE_STATE permission and we don't have it.
50      */
51     // TODO: Figure out why we don't have the permission declared in the manifest.
52     @SmallTest
testWithNumberNotEqualToVoiceMail()53     public void testWithNumberNotEqualToVoiceMail() throws Exception {
54         assertFalse(PhoneNumberUtils.isVoiceMailNumber("911"));
55         assertFalse(PhoneNumberUtils.isVoiceMailNumber("tel:911"));
56         assertFalse(PhoneNumberUtils.isVoiceMailNumber("+18001234567"));
57         assertFalse(PhoneNumberUtils.isVoiceMailNumber(""));
58         assertFalse(PhoneNumberUtils.isVoiceMailNumber(null));
59         // FIXME:
60         // assertTrue(PhoneNumberUtils.isVoiceMailNumber(mVoiceMailNumber));
61     }
62 
63 }
64