diff options
author | Scott Kennedy <skennedy@google.com> | 2013-03-06 22:20:13 -0800 |
---|---|---|
committer | Scott Kennedy <skennedy@google.com> | 2013-03-06 22:20:13 -0800 |
commit | 403e0d211ded97679e8c983481f9972f0a4b22c0 (patch) | |
tree | 96c9ddcf9914920d062f8c9f07d2616dba7c275f /chips | |
parent | 42ae8ba360efc42cc03d8e754a7ddd7dbd0ae92f (diff) | |
download | android_frameworks_ex-403e0d211ded97679e8c983481f9972f0a4b22c0.tar.gz android_frameworks_ex-403e0d211ded97679e8c983481f9972f0a4b22c0.tar.bz2 android_frameworks_ex-403e0d211ded97679e8c983481f9972f0a4b22c0.zip |
Fix a failing test
Change-Id: Iaa45618d69ea12aa6714bcae36c8f12a253d5df2
Diffstat (limited to 'chips')
-rw-r--r-- | chips/src/com/android/ex/chips/RecipientEntry.java | 9 | ||||
-rw-r--r-- | chips/tests/src/com/android/ex/chips/ChipsTest.java | 1 |
2 files changed, 7 insertions, 3 deletions
diff --git a/chips/src/com/android/ex/chips/RecipientEntry.java b/chips/src/com/android/ex/chips/RecipientEntry.java index 1a79f32..14b11e1 100644 --- a/chips/src/com/android/ex/chips/RecipientEntry.java +++ b/chips/src/com/android/ex/chips/RecipientEntry.java @@ -19,6 +19,8 @@ package com.android.ex.chips; import android.net.Uri; import android.provider.ContactsContract.CommonDataKinds.Email; import android.provider.ContactsContract.DisplayNameSources; +import android.text.util.Rfc822Token; +import android.text.util.Rfc822Tokenizer; /** * Represents one entry inside recipient auto-complete list. @@ -106,8 +108,11 @@ public class RecipientEntry { * This address has not been resolved to a contact and therefore does not * have a contact id or photo. */ - public static RecipientEntry constructFakeEntry(String address, boolean isValid) { - return new RecipientEntry(ENTRY_TYPE_PERSON, address, address, + public static RecipientEntry constructFakeEntry(final String address, final boolean isValid) { + final Rfc822Token[] tokens = Rfc822Tokenizer.tokenize(address); + final String tokenizedAddress = tokens[0].getAddress(); + + return new RecipientEntry(ENTRY_TYPE_PERSON, tokenizedAddress, tokenizedAddress, INVALID_DESTINATION_TYPE, null, INVALID_CONTACT, INVALID_CONTACT, null, true, isValid); } diff --git a/chips/tests/src/com/android/ex/chips/ChipsTest.java b/chips/tests/src/com/android/ex/chips/ChipsTest.java index 480335a..534b34f 100644 --- a/chips/tests/src/com/android/ex/chips/ChipsTest.java +++ b/chips/tests/src/com/android/ex/chips/ChipsTest.java @@ -142,7 +142,6 @@ public class ChipsTest extends AndroidTestCase { "\"User Name, Jr\" <user@username.com>, ", testAddress); assertEquals("Expected a displayable name", "User Name, Jr", testDisplay); - RecipientEntry alreadyFormatted = RecipientEntry.constructFakeEntry("user@username.com, ", true); testAddress = view.createAddressText(alreadyFormatted); |