|
36 | 36 | import static com.firebase.ui.auth.ui.phone.PhoneNumberUtils.getPhoneNumber; |
37 | 37 | import static com.firebase.ui.auth.ui.phone.PhoneTestConstants.RAW_PHONE; |
38 | 38 | import static org.junit.Assert.assertEquals; |
39 | | -import static org.junit.Assert.assertNull; |
40 | 39 | import static org.mockito.Mockito.mock; |
41 | 40 | import static org.mockito.Mockito.when; |
42 | 41 |
|
@@ -83,40 +82,6 @@ public void testGetCountryCode() throws Exception { |
83 | 82 | assertEquals(null, getCountryCode(new Locale("", "DJJZ").getCountry())); |
84 | 83 | } |
85 | 84 |
|
86 | | - @Test |
87 | | - @Config(constants = BuildConfig.class, sdk = 21) |
88 | | - public void testFormatNumberToE164_aboveApi21() { |
89 | | - String validPhoneNumber = "+919994947354"; |
90 | | - CountryInfo indiaCountryInfo = new CountryInfo(new Locale("", "IN"), 91); |
91 | | - //no leading plus |
92 | | - assertEquals(validPhoneNumber, formatPhoneNumber("9994947354", indiaCountryInfo)); |
93 | | - //no country code |
94 | | - assertEquals(validPhoneNumber, formatPhoneNumber("919994947354", indiaCountryInfo)); |
95 | | - //fully formatted |
96 | | - assertEquals(validPhoneNumber, formatPhoneNumber("+919994947354", indiaCountryInfo)); |
97 | | - //with hyphens |
98 | | - assertEquals(validPhoneNumber, formatPhoneNumber("+91-(999)-(49)-(47354)", indiaCountryInfo)); |
99 | | - //with spaces leading plus |
100 | | - assertEquals(validPhoneNumber, formatPhoneNumber("+91 99949 47354", indiaCountryInfo)); |
101 | | - // space formatting |
102 | | - assertEquals(validPhoneNumber, formatPhoneNumber("91 99949 47354", indiaCountryInfo)); |
103 | | - // parantheses and hyphens |
104 | | - assertEquals(validPhoneNumber, formatPhoneNumber("(99949) 47-354", indiaCountryInfo)); |
105 | | - // mismatched country |
106 | | - assertEquals(validPhoneNumber, formatPhoneNumber("+919994947354", |
107 | | - new CountryInfo( |
108 | | - new Locale("", "US"), 1))); |
109 | | - // incorrect country with well formatted number |
110 | | - assertNull(formatPhoneNumber("999474735", indiaCountryInfo)); |
111 | | - |
112 | | - // incorrect country with unformattednumber |
113 | | - assertNull(validPhoneNumber, formatPhoneNumber( |
114 | | - "919994947354", new CountryInfo(new Locale("", "US"), 1))); |
115 | | - //incorrect country, incorrect phone number |
116 | | - assertNull(formatPhoneNumber("+914349873457", new CountryInfo( |
117 | | - new Locale("", "US"), 1))); |
118 | | - } |
119 | | - |
120 | 85 | @Test |
121 | 86 | @Config(constants = BuildConfig.class, sdk = 16) |
122 | 87 | public void testFormatNumberToE164_belowApi21() { |
|
0 commit comments