diff options
author | Tammo Spalink <tammo@google.com> | 2009-10-19 14:10:47 +0800 |
---|---|---|
committer | Tammo Spalink <tammo@google.com> | 2009-10-21 10:30:58 +0800 |
commit | 9e534153264138cfee383c626db92b934fafc1af (patch) | |
tree | bad43dee9a316223b1c468f6e057fd6c470a51ac /tests/CoreTests | |
parent | eab82c3c8c9dd88ff7267c154b415558d8e5c206 (diff) | |
download | frameworks_base-9e534153264138cfee383c626db92b934fafc1af.zip frameworks_base-9e534153264138cfee383c626db92b934fafc1af.tar.gz frameworks_base-9e534153264138cfee383c626db92b934fafc1af.tar.bz2 |
Let PLUS occur once anywhere in dial-str network portion.
Create a new extractNetworkPortion() function, since the old one is
public, that does effectively the same thing but is more flexible as
just mentioned.
Addresses issue:
http://buganizer/issue?id=2013998
Change-Id: Ie5df08ef9c871881e8728a44abf0385908000823
Diffstat (limited to 'tests/CoreTests')
-rw-r--r-- | tests/CoreTests/com/android/internal/telephony/PhoneNumberUtilsTest.java | 64 |
1 files changed, 63 insertions, 1 deletions
diff --git a/tests/CoreTests/com/android/internal/telephony/PhoneNumberUtilsTest.java b/tests/CoreTests/com/android/internal/telephony/PhoneNumberUtilsTest.java index 20ea4d7..a4e253e 100644 --- a/tests/CoreTests/com/android/internal/telephony/PhoneNumberUtilsTest.java +++ b/tests/CoreTests/com/android/internal/telephony/PhoneNumberUtilsTest.java @@ -25,7 +25,7 @@ import junit.framework.TestCase; public class PhoneNumberUtilsTest extends TestCase { @SmallTest - public void testA() throws Exception { + public void testExtractNetworkPortion() throws Exception { assertEquals( "+17005554141", PhoneNumberUtils.extractNetworkPortion("+17005554141") @@ -181,6 +181,68 @@ public class PhoneNumberUtilsTest extends TestCase { } @SmallTest + public void testExtractNetworkPortionAlt() throws Exception { + assertEquals( + "+17005554141", + PhoneNumberUtils.extractNetworkPortionAlt("+17005554141") + ); + + assertEquals( + "+17005554141", + PhoneNumberUtils.extractNetworkPortionAlt("+1 (700).555-4141") + ); + + assertEquals( + "17005554141", + PhoneNumberUtils.extractNetworkPortionAlt("1 (700).555-4141") + ); + + // This may seem wrong, but it's probably ok + assertEquals( + "17005554141*#", + PhoneNumberUtils.extractNetworkPortionAlt("1 (700).555-4141*#") + ); + + assertEquals( + "170055541NN", + PhoneNumberUtils.extractNetworkPortionAlt("1 (700).555-41NN") + ); + + assertEquals( + "170055541NN", + PhoneNumberUtils.extractNetworkPortionAlt("1 (700).555-41NN,1234") + ); + + assertEquals( + "170055541NN", + PhoneNumberUtils.extractNetworkPortionAlt("1 (700).555-41NN;1234") + ); + + // An MMI string is unperterbed, even though it contains a + // (valid in this case) embedded + + assertEquals( + "**21**+17005554141#", + PhoneNumberUtils.extractNetworkPortionAlt("**21**+17005554141#") + ); + + assertEquals( + "*31#+447966164208", + PhoneNumberUtils.extractNetworkPortionAlt("*31#+447966164208") + ); + + assertEquals( + "*31#+447966164208", + PhoneNumberUtils.extractNetworkPortionAlt("*31# (+44) 79 6616 4208") + ); + + assertEquals("", PhoneNumberUtils.extractNetworkPortionAlt("")); + + assertEquals("", PhoneNumberUtils.extractNetworkPortionAlt(",1234")); + + assertNull(PhoneNumberUtils.extractNetworkPortionAlt(null)); + } + + @SmallTest public void testB() throws Exception { assertEquals("", PhoneNumberUtils.extractPostDialPortion("+17005554141")); assertEquals("", PhoneNumberUtils.extractPostDialPortion("+1 (700).555-4141")); |