aboutsummaryrefslogtreecommitdiff
path: root/tests/src/com/android
diff options
context:
space:
mode:
authorGrace Jia <xiaotonj@google.com>2021-01-15 14:02:53 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2021-01-15 14:02:53 +0000
commit653cf4be1a2e56bc22928839c84b723d6a367007 (patch)
tree1d0e6394891fc59bd12f939cfd0537a78ad1f56e /tests/src/com/android
parentb562da046c06bf565a2676a948b1b63432aa9e19 (diff)
parent35c681b6ed5d0ca049e4808612148f78dc603d86 (diff)
downloadContactsProvider-653cf4be1a2e56bc22928839c84b723d6a367007.tar.gz
Merge "Use new phone number match method in Java directly as a new filter in ContactsProvider2." am: 03db749ca3 am: 8884eb88a6 am: 35c681b6ed
Original change: https://android-review.googlesource.com/c/platform/packages/providers/ContactsProvider/+/1449515 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: Iaca4012e9d4491259a20710965a815af339df266
Diffstat (limited to 'tests/src/com/android')
-rw-r--r--tests/src/com/android/providers/contacts/ContactsProvider2Test.java32
1 files changed, 16 insertions, 16 deletions
diff --git a/tests/src/com/android/providers/contacts/ContactsProvider2Test.java b/tests/src/com/android/providers/contacts/ContactsProvider2Test.java
index 0f5b652d..7efc2f47 100644
--- a/tests/src/com/android/providers/contacts/ContactsProvider2Test.java
+++ b/tests/src/com/android/providers/contacts/ContactsProvider2Test.java
@@ -1678,9 +1678,9 @@ public class ContactsProvider2Test extends BaseContactsProvider2Test {
assertStoredValues(lookupUri1, null, null, new ContentValues[] {values, values});
// In the context that 8004664411 is a valid number, "4664411" as a
- // call id should match to both "8004664411" and "+18004664411".
+ // call id should not match to either "8004664411" or "+18004664411".
Uri lookupUri2 = Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, "4664411");
- assertEquals(2, getCount(lookupUri2, null, null));
+ assertEquals(0, getCount(lookupUri2, null, null));
// A wrong area code 799 vs 800 should not be matched
lookupUri2 = Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, "7994664411");
@@ -1911,13 +1911,13 @@ public class ContactsProvider2Test extends BaseContactsProvider2Test {
values.clear();
- // match with international format
+ // No match with international format
lookupUri2 = Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, "+1 650 861 0002");
- assertEquals(1, getCount(lookupUri2, null, null));
+ assertEquals(0, getCount(lookupUri2, null, null));
- // match with national format
+ // No match with national format
lookupUri2 = Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, "650 861 0002");
- assertEquals(1, getCount(lookupUri2, null, null));
+ assertEquals(0, getCount(lookupUri2, null, null));
}
public void testIntlPhoneLookupUseCases() {
@@ -1936,20 +1936,20 @@ public class ContactsProvider2Test extends BaseContactsProvider2Test {
assertEquals(2, getCount(Uri.withAppendedPath(
PhoneLookup.CONTENT_FILTER_URI, fullNumber), null, null));
- // Shorter (local) number with 0 prefix should also match.
- assertEquals(2, getCount(Uri.withAppendedPath(
+ // Shorter (local) number with 0 prefix should not match.
+ assertEquals(0, getCount(Uri.withAppendedPath(
PhoneLookup.CONTENT_FILTER_URI, "097427289"), null, null));
// Number with international (+972) prefix should also match.
assertEquals(1, getCount(Uri.withAppendedPath(
PhoneLookup.CONTENT_FILTER_URI, "+97297427289"), null, null));
- // Same shorter number with dashes should match.
- assertEquals(2, getCount(Uri.withAppendedPath(
+ // Same shorter number with dashes should not match.
+ assertEquals(0, getCount(Uri.withAppendedPath(
PhoneLookup.CONTENT_FILTER_URI, "09-742-7289"), null, null));
- // Same shorter number with spaces should match.
- assertEquals(2, getCount(Uri.withAppendedPath(
+ // Same shorter number with spaces should not match.
+ assertEquals(0, getCount(Uri.withAppendedPath(
PhoneLookup.CONTENT_FILTER_URI, "09 742 7289"), null, null));
// Some other number should not match.
@@ -1971,16 +1971,16 @@ public class ContactsProvider2Test extends BaseContactsProvider2Test {
assertEquals(1, getCount(Uri.withAppendedPath(
PhoneLookup.CONTENT_FILTER_URI, "0796010101"), null, null));
- assertEquals(1, getCount(Uri.withAppendedPath(
+ assertEquals(0, getCount(Uri.withAppendedPath(
PhoneLookup.CONTENT_FILTER_URI, "+48796010101"), null, null));
- assertEquals(1, getCount(Uri.withAppendedPath(
+ assertEquals(0, getCount(Uri.withAppendedPath(
PhoneLookup.CONTENT_FILTER_URI, "48796010101"), null, null));
- assertEquals(1, getCount(Uri.withAppendedPath(
+ assertEquals(0, getCount(Uri.withAppendedPath(
PhoneLookup.CONTENT_FILTER_URI, "4-879-601-0101"), null, null));
- assertEquals(1, getCount(Uri.withAppendedPath(
+ assertEquals(0, getCount(Uri.withAppendedPath(
PhoneLookup.CONTENT_FILTER_URI, "4 879 601 0101"), null, null));
}