Java Code Examples for org.whispersystems.signalservice.api.util.PhoneNumberFormatter#formatNumber()

The following examples show how to use org.whispersystems.signalservice.api.util.PhoneNumberFormatter#formatNumber() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PhoneNumberFormatterTest.java    From mollyim-android with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void testFormatNumberEmail() throws Exception {
  try {
    PhoneNumberFormatter.formatNumber("[email protected]", LOCAL_NUMBER_US);
    throw new AssertionFailedError("should have thrown on email");
  } catch (InvalidNumberException ine) {
    // success
  }
}
 
Example 2
Source File: PhoneNumberFormatterTest.java    From libsignal-service-java with GNU General Public License v3.0 5 votes vote down vote up
public void testFormatNumberEmail() throws Exception {
  try {
    PhoneNumberFormatter.formatNumber("[email protected]", LOCAL_NUMBER_US);
    throw new AssertionFailedError("should have thrown on email");
  } catch (InvalidNumberException ine) {
    // success
  }
}
 
Example 3
Source File: Manager.java    From signald with GNU General Public License v3.0 4 votes vote down vote up
private String canonicalizeNumber(String number) throws InvalidNumberException {
    String localNumber = accountData.username;
    return PhoneNumberFormatter.formatNumber(number, localNumber);
}
 
Example 4
Source File: Util.java    From signal-cli with GNU General Public License v3.0 4 votes vote down vote up
public static String canonicalizeNumber(String number, String localNumber) throws InvalidNumberException {
    return PhoneNumberFormatter.formatNumber(number, localNumber);
}