PhoneNumberHandlerBase { public static String formatRFC396(Object data, String regionCode) { PhoneNumber phoneNumber = parseToPhoneNumber(data, regionCode); if (phoneNumber == null) { return StringUtils.EMPTY; } return GOOGLE_PHONE_UTIL.format(phoneNumber, PhoneNumberFormat.RFC3966); }  static PhoneNumber parseToPhoneNumber(Object data, String regionCode); static boolean isValidPhoneNumber(Object data, String regionCode); static boolean isPossiblePhoneNumber(Object data, String regionCode); static String formatE164(Object data, String regionCode); static String formatInternational(Object data, String regionCode); static String formatNational(Object data, String regionCode); static String formatRFC396(Object data, String regionCode); static Set<String> getSupportedRegions(); static int getCountryCodeForRegion(String regionCode); static int getCountryCodeForPhoneNumber(PhoneNumber number); static PhoneNumberTypeEnum getPhoneNumberType(Object data, String regionCode); static PhoneNumberTypeEnum getPhoneNumberType(PhoneNumber number); static boolean containsValidRegionCode(Object data); static String extractRegionCode(Object phoneData); static String extractRegionCode(Object phoneData, String regionCode); static String extractRegionCode(PhoneNumber phoneNumber); static int extractCountrycode(Object phoneData); static String getGeocoderDescriptionForNumber(Object data, String regionCode, Locale languageCode); static String getGeocoderDescriptionForNumber(PhoneNumber number, Locale languageCode); static String getCarrierNameForNumber(Object data, String regionCode, Locale languageCode); static String getCarrierNameForNumber(PhoneNumber number, Locale languageCode); static List<String> getTimeZonesForNumber(Object data, String regionCode); static List<String> getTimeZonesForNumber(PhoneNumber number); static List<String> getTimeZonesForNumber(Object data, String regionCode, boolean withUnknownTimeZone); static List<String> getTimeZonesForNumber(PhoneNumber phoneNumber, boolean withUnknownTimeZone);  }
@Test public void testFormatRFC396() { assertEquals(StringUtils.EMPTY, PhoneNumberHandlerBase.formatRFC396(null, REGCODE_FR)); assertEquals("tel:+33-6-56-96-58-22", PhoneNumberHandlerBase.formatRFC396(FR_NUM_1, REGCODE_FR)); assertEquals("tel:+33-1-47-55-43-23", PhoneNumberHandlerBase.formatRFC396(FR_NUM_2, REGCODE_FR)); assertEquals("tel:+33-6-62-96-58-22", PhoneNumberHandlerBase.formatRFC396(FR_NUM_5, REGCODE_FR)); assertEquals("tel:+1-541-754-3010", PhoneNumberHandlerBase.formatRFC396(US_NUM_1, REGCODE_US)); assertEquals("tel:+1-541-754-3010", PhoneNumberHandlerBase.formatRFC396(US_NUM_2, REGCODE_US)); assertEquals("tel:+1-541-754-3010", PhoneNumberHandlerBase.formatRFC396(US_NUM_4, REGCODE_US)); assertEquals("tel:+49-89-63648018", PhoneNumberHandlerBase.formatRFC396(DE_NUM_1, REGCODE_DE)); assertEquals("tel:+49-19498963648018", PhoneNumberHandlerBase.formatRFC396(DE_NUM_2, REGCODE_DE)); assertEquals("tel:+49-89-63648018", PhoneNumberHandlerBase.formatRFC396(DE_NUM_3, REGCODE_DE)); assertEquals("tel:+81-3-1258-2584", PhoneNumberHandlerBase.formatRFC396(JP_NUM_1, REGCODE_JP)); assertEquals("tel:+81-80-2587-9512", PhoneNumberHandlerBase.formatRFC396(JP_NUM_2, REGCODE_JP)); assertEquals("tel:+81-463-25-8888", PhoneNumberHandlerBase.formatRFC396(JP_NUM_3, REGCODE_JP)); assertEquals("tel:+81-70-3333-3222", PhoneNumberHandlerBase.formatRFC396(JP_NUM_4, REGCODE_JP)); assertEquals("tel:+81-52-2451-4455", PhoneNumberHandlerBase.formatRFC396(JP_NUM_5, REGCODE_JP)); }