summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorWalter Jang <wjang@google.com>2016-03-31 09:03:18 -0700
committerWalter Jang <wjang@google.com>2016-03-31 14:07:12 -0700
commitc7a1f3500246db78e395fa07d87134f22e68f07a (patch)
tree0e7f19f9671d03becd5b4b09b5186cc13294dbab /tests
parent31d6aa082ba7106844b6a55e045ce5efe3845ddf (diff)
downloadandroid_packages_apps_ContactsCommon-c7a1f3500246db78e395fa07d87134f22e68f07a.tar.gz
android_packages_apps_ContactsCommon-c7a1f3500246db78e395fa07d87134f22e68f07a.tar.bz2
android_packages_apps_ContactsCommon-c7a1f3500246db78e395fa07d87134f22e68f07a.zip
DO NOT MERGE ANYWHERE Remove display name search experiment (1/2)
Bug 27785615 Change-Id: I7e40a9e0215dc829dc28ebe4a24552305b864448
Diffstat (limited to 'tests')
-rw-r--r--tests/src/com/android/contacts/common/list/DefaultContactListAdapterTest.java76
1 files changed, 0 insertions, 76 deletions
diff --git a/tests/src/com/android/contacts/common/list/DefaultContactListAdapterTest.java b/tests/src/com/android/contacts/common/list/DefaultContactListAdapterTest.java
deleted file mode 100644
index b8a9a0ec..00000000
--- a/tests/src/com/android/contacts/common/list/DefaultContactListAdapterTest.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.contacts.common.list;
-
-import android.provider.ContactsContract.Contacts;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.SmallTest;
-
-import java.util.Arrays;
-
-import static com.android.contacts.common.list.DefaultContactListAdapter.getDisplayNameSelection;
-import static com.android.contacts.common.list.DefaultContactListAdapter.getDisplayNameSelectionArgs;
-
-/**
- * Unit tests for {@link com.android.contacts.common.list.DefaultContactListAdapter}.
- */
-@SmallTest
-public class DefaultContactListAdapterTest extends AndroidTestCase {
-
- public void testDisplayNameSelection() {
- final String dn = Contacts.DISPLAY_NAME;
- assertNull(getDisplayNameSelection(null, dn));
- assertNull(getDisplayNameSelection("", dn));
- assertNull(getDisplayNameSelection(" ", dn));
- assertNull(getDisplayNameSelection("\t", dn));
- assertNull(getDisplayNameSelection("\t ", dn));
-
- final String pn = Contacts.PHONETIC_NAME;
- String expected = "(" + dn + " LIKE ?1 OR " + pn + " LIKE ?1)";
- assertEquals(expected, getDisplayNameSelection("foo", dn));
-
- expected = "(" + dn + " LIKE ?1 OR " + pn + " LIKE ?1) OR " +
- "(" + dn + " LIKE ?2 OR " + pn + " LIKE ?2)";
- assertEquals(expected, getDisplayNameSelection("foo bar", dn));
- assertEquals(expected, getDisplayNameSelection(" foo bar ", dn));
- assertEquals(expected, getDisplayNameSelection("foo\t bar", dn));
- assertEquals(expected, getDisplayNameSelection(" \tfoo\t bar\t ", dn));
- }
-
- public void testDisplayNameSelectionArgs() {
- assertNull(getDisplayNameSelectionArgs(null));
- assertNull(getDisplayNameSelectionArgs(""));
- assertNull(getDisplayNameSelectionArgs(" "));
- assertNull(getDisplayNameSelectionArgs("\t"));
- assertNull(getDisplayNameSelectionArgs("\t "));
-
- String[] expected = new String[]{"foo%"};
- assertArrayEquals(expected, getDisplayNameSelectionArgs("foo"));
-
- expected = new String[]{"foo%","bar%"};
- assertArrayEquals(expected, getDisplayNameSelectionArgs("foo bar"));
- assertArrayEquals(expected, getDisplayNameSelectionArgs(" foo bar "));
- assertArrayEquals(expected, getDisplayNameSelectionArgs("foo\t bar"));
- assertArrayEquals(expected, getDisplayNameSelectionArgs("\t foo\t bar\t "));
- }
-
- private void assertArrayEquals(String[] expected, String[] actual) {
- if (expected == null && actual == null) return;
- if (expected == null || actual == null) fail("expected:" + expected + " but was:" + actual);
- assertEquals(Arrays.toString(expected), Arrays.toString(actual));
- }
-} \ No newline at end of file