diff options
author | Brandon Maxwell <maxwelb@google.com> | 2015-11-02 11:28:35 -0800 |
---|---|---|
committer | Brandon Maxwell <maxwelb@google.com> | 2015-11-03 15:47:39 -0800 |
commit | ab4443c7e235e0feebca7eadf70ecd9bd2455b46 (patch) | |
tree | f78f94a64037c39046f3a82c2b13e13b39962dca /tests/src/com/android | |
parent | 7d048b14177813c9c2b857c67d69698af466a5c7 (diff) |
Changing method to public, static for use in InCallUi
+ Changed ContactInfoHelper.lookUpDisplayNameAlternative to public so
it's usable in InCallUi
+ Changed ContactInfoHelper.lookUpDisplayNamealternative to static to
cut down on object creation
+ Added tests for lookUpDisplayNameAlternative since it is public
Change-Id: Iede746655a1ca773cb0cd8cf26df665e34ab47fc
Diffstat (limited to 'tests/src/com/android')
-rw-r--r-- | tests/src/com/android/dialer/calllog/ContactInfoHelperTest.java | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/tests/src/com/android/dialer/calllog/ContactInfoHelperTest.java b/tests/src/com/android/dialer/calllog/ContactInfoHelperTest.java index 6db738443..588a27fcf 100644 --- a/tests/src/com/android/dialer/calllog/ContactInfoHelperTest.java +++ b/tests/src/com/android/dialer/calllog/ContactInfoHelperTest.java @@ -57,11 +57,11 @@ public class ContactInfoHelperTest extends AndroidTestCase { mContactInfoHelper = new ContactInfoHelper(mContext, TEST_COUNTRY_ISO); } - public void testLookupContactFromUriNullUri() { + public void testLookupContactFromUri_NullUri() { Assert.assertNull(mContactInfoHelper.lookupContactFromUri(null)); } - public void testLookupContactFromUriNoResults() { + public void testLookupContactFromUri_NoResults() { setUpQueryExpectations(PhoneLookup.ENTERPRISE_CONTENT_FILTER_URI, PhoneQuery.PHONE_LOOKUP_PROJECTION); @@ -70,7 +70,7 @@ public class ContactInfoHelperTest extends AndroidTestCase { mContext.verify(); } - public void testLookupContactFromUriNoDisplayNameAlternative() { + public void testLookupContactFromUri_NoDisplayNameAlternative() { setUpQueryExpectations(PhoneLookup.ENTERPRISE_CONTENT_FILTER_URI, PhoneQuery.PHONE_LOOKUP_PROJECTION, TEST_LOOKUP_ROW); setUpQueryExpectations(displayNameAlternativeUri, @@ -83,7 +83,7 @@ public class ContactInfoHelperTest extends AndroidTestCase { mContext.verify(); } - public void testLookupContactFromUriWithDisplayNameAlternative() { + public void testLookupContactFromUri_HasDisplayNameAlternative() { setUpQueryExpectations(PhoneLookup.ENTERPRISE_CONTENT_FILTER_URI, PhoneQuery.PHONE_LOOKUP_PROJECTION, TEST_LOOKUP_ROW); setUpQueryExpectations(displayNameAlternativeUri, @@ -96,6 +96,25 @@ public class ContactInfoHelperTest extends AndroidTestCase { mContext.verify(); } + public void testLookupDisplayNameAlternative_NullLookup() { + Assert.assertNull(mContactInfoHelper.lookUpDisplayNameAlternative(mContext, null)); + } + + public void testLookupDisplayNameAlternative_NoResults() { + setUpQueryExpectations(displayNameAlternativeUri, + PhoneQuery.DISPLAY_NAME_ALTERNATIVE_PROJECTION); + Assert.assertNull(mContactInfoHelper.lookUpDisplayNameAlternative(mContext, TEST_LOOKUP_KEY)); + mContext.verify(); + } + + public void testLookupDisplayNameAlternative_HasDisplayNameAlternative() { + setUpQueryExpectations(displayNameAlternativeUri, + PhoneQuery.DISPLAY_NAME_ALTERNATIVE_PROJECTION, TEST_DISPLAY_NAME_ALTERNATIVE_ROW); + Assert.assertEquals(TEST_DISPLAY_NAME_ALTERNATIVE, + mContactInfoHelper.lookUpDisplayNameAlternative(mContext, TEST_LOOKUP_KEY)); + mContext.verify(); + } + /* * Sets up query expectations to return the given row for all queries for the given * uri and projection. If row is null, an empty cursor is returned for query calls |