forked from signalapp/Signal-Android
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes signalapp#3904 // FREEBIE
- Loading branch information
Showing
5 changed files
with
37 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 4 additions & 11 deletions
15
...uresms/util/PhoneNumberFormatterTest.java → ...uresms/util/PhoneNumberFormatterTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,28 @@ | ||
package org.thoughtcrime.securesms.util; | ||
|
||
import android.test.AndroidTestCase; | ||
|
||
import junit.framework.AssertionFailedError; | ||
|
||
import org.thoughtcrime.securesms.TextSecureTestCase; | ||
import org.junit.Test; | ||
import org.whispersystems.textsecure.api.util.InvalidNumberException; | ||
import org.whispersystems.textsecure.api.util.PhoneNumberFormatter; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
public class PhoneNumberFormatterTest extends TextSecureTestCase { | ||
public class PhoneNumberFormatterTest { | ||
private static final String LOCAL_NUMBER = "+15555555555"; | ||
|
||
public void testFormatNumberE164() throws Exception, InvalidNumberException { | ||
@Test public void testFormatNumberE164() throws Exception, InvalidNumberException { | ||
assertThat(PhoneNumberFormatter.formatNumber("(555) 555-5555", LOCAL_NUMBER)).isEqualTo(LOCAL_NUMBER); | ||
assertThat(PhoneNumberFormatter.formatNumber("555-5555", LOCAL_NUMBER)).isEqualTo(LOCAL_NUMBER); | ||
assertThat(PhoneNumberFormatter.formatNumber("(123) 555-5555", LOCAL_NUMBER)).isNotEqualTo(LOCAL_NUMBER); | ||
} | ||
|
||
public void testFormatNumberEmail() throws Exception { | ||
@Test public void testFormatNumberEmail() throws Exception { | ||
try { | ||
PhoneNumberFormatter.formatNumber("[email protected]", LOCAL_NUMBER); | ||
throw new AssertionFailedError("should have thrown on email"); | ||
} catch (InvalidNumberException ine) { | ||
// success | ||
} | ||
} | ||
|
||
@Override | ||
public void setUp() throws Exception { | ||
super.setUp(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters