mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-15 12:19:54 +01:00
Accept phone numbers starting with +.
This commit is contained in:
@@ -8,27 +8,54 @@ public class CountryCodesTest extends BriarTestCase {
|
||||
|
||||
@Test
|
||||
public void testTranslation() {
|
||||
// Unknown country for caller
|
||||
// Unrecognised country for caller
|
||||
assertNull(CountryCodes.translate("02012345678", "ZZ", "GB"));
|
||||
// Unknown country for callee
|
||||
// Unrecognised country for callee
|
||||
assertNull(CountryCodes.translate("02012345678", "GB", "ZZ"));
|
||||
// GB to GB, callee has included NDD prefix
|
||||
assertEquals("02012345678",
|
||||
CountryCodes.translate("02012345678", "GB", "GB"));
|
||||
// GB to GB, callee has included IDD prefix and country code
|
||||
assertEquals("02012345678",
|
||||
CountryCodes.translate("00442012345678", "GB", "GB"));
|
||||
|
||||
// GB to GB, callee has not included a prefix
|
||||
assertEquals("02012345678",
|
||||
CountryCodes.translate("2012345678", "GB", "GB"));
|
||||
// Russia to GB, callee has included NDD prefix
|
||||
assertEquals("8**10442012345678",
|
||||
CountryCodes.translate("02012345678", "RU", "GB"));
|
||||
// Russia to GB, callee has included IDD prefix and country code
|
||||
assertEquals("8**10442012345678",
|
||||
CountryCodes.translate("00442012345678", "RU", "GB"));
|
||||
// GB to GB, callee has included NDD prefix
|
||||
assertEquals("02012345678",
|
||||
CountryCodes.translate("02012345678", "GB", "GB"));
|
||||
// GB to GB, callee has included plus sign and country code
|
||||
assertEquals("02012345678",
|
||||
CountryCodes.translate("+442012345678", "GB", "GB"));
|
||||
// GB to GB, callee has included IDD prefix and country code
|
||||
assertEquals("02012345678",
|
||||
CountryCodes.translate("00442012345678", "GB", "GB"));
|
||||
|
||||
// Russia to GB, callee has not included a prefix
|
||||
assertEquals("8**10442012345678",
|
||||
CountryCodes.translate("2012345678", "RU", "GB"));
|
||||
// Russia to GB, callee has included NDD prefix
|
||||
assertEquals("8**10442012345678",
|
||||
CountryCodes.translate("02012345678", "RU", "GB"));
|
||||
// Russia to GB, callee has included plus sign and country code
|
||||
assertEquals("8**10442012345678",
|
||||
CountryCodes.translate("+442012345678", "RU", "GB"));
|
||||
// Russia to GB, callee has included IDD prefix and country code
|
||||
assertEquals("8**10442012345678",
|
||||
CountryCodes.translate("00442012345678", "RU", "GB"));
|
||||
|
||||
// Andorra to Andorra (no NDD), callee has not included a prefix
|
||||
assertEquals("765432", CountryCodes.translate("765432", "AD", "AD"));
|
||||
// Andorra to Andorra, callee has included plus sign and country code
|
||||
assertEquals("765432",
|
||||
CountryCodes.translate("+376765432", "AD", "AD"));
|
||||
// Andorra to Andorra, callee has included IDD and country code
|
||||
assertEquals("765432",
|
||||
CountryCodes.translate("00376765432", "AD", "AD"));
|
||||
|
||||
// GB to Andorra (no NDD), callee has not included a prefix
|
||||
assertEquals("00376765432",
|
||||
CountryCodes.translate("765432", "GB", "AD"));
|
||||
// GB to Andorra, callee has included plus sign and country code
|
||||
assertEquals("00376765432",
|
||||
CountryCodes.translate("+376765432", "GB", "AD"));
|
||||
// GB to Andorra, callee has included IDD and country code
|
||||
assertEquals("00376765432",
|
||||
CountryCodes.translate("00376765432", "GB", "AD"));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user