diff options
author | James Lemieux <jplemieux@google.com> | 2014-01-16 15:57:16 -0800 |
---|---|---|
committer | James Lemieux <jplemieux@google.com> | 2014-01-16 17:29:56 -0800 |
commit | 70ebf05c8afcef77f3a63ffac011ed37b580f1e5 (patch) | |
tree | 9f202f271e1bf93cc81286159c52fe6f9f78c3b8 /tests | |
parent | a4296c179cd4eb12e7c4912d72c22dd2ec724a7e (diff) | |
download | android_packages_apps_UnifiedEmail-70ebf05c8afcef77f3a63ffac011ed37b580f1e5.tar.gz android_packages_apps_UnifiedEmail-70ebf05c8afcef77f3a63ffac011ed37b580f1e5.tar.bz2 android_packages_apps_UnifiedEmail-70ebf05c8afcef77f3a63ffac011ed37b580f1e5.zip |
Fix broken test cases.
HierarchicalFolderTruncationTests were all broken because the assertions were attempting to
compare java.lang.Strings to android.text.SpannableStringBuilders.
Change-Id: Ibf641cddbaf546b26af414087d0f2b84f4fe1ba4
Diffstat (limited to 'tests')
-rw-r--r-- | tests/src/com/android/mail/ui/HierarchicalFolderTruncationTests.java | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/tests/src/com/android/mail/ui/HierarchicalFolderTruncationTests.java b/tests/src/com/android/mail/ui/HierarchicalFolderTruncationTests.java index f9777aa28..24278f935 100644 --- a/tests/src/com/android/mail/ui/HierarchicalFolderTruncationTests.java +++ b/tests/src/com/android/mail/ui/HierarchicalFolderTruncationTests.java @@ -18,6 +18,7 @@ package com.android.mail.ui; import android.test.AndroidTestCase; +import android.text.SpannableStringBuilder; public class HierarchicalFolderTruncationTests extends AndroidTestCase { @@ -30,24 +31,28 @@ public class HierarchicalFolderTruncationTests extends AndroidTestCase { } public void testEmpty() { - assertEquals("", mAdapter.truncateHierarchy(null)); + assertNull(truncate(null)); } public void testNoParents() { - assertEquals("name", mAdapter.truncateHierarchy("name")); + assertEquals("name", truncate("name")); } public void testSingleParent() { - assertEquals("parent\u2215folder", mAdapter.truncateHierarchy("parent/folder")); + assertEquals("parent\u2215folder", truncate("parent/folder")); } public void testDoubleParent() { - assertEquals("grandparent\u2215parent\u2215folder", - mAdapter.truncateHierarchy("grandparent/parent/folder")); + assertEquals("grandparent\u2215parent\u2215folder", truncate("grandparent/parent/folder")); } public void testEllipsizedDoubleParent() { assertEquals("grandparent\u2215\u2026\u2215parent\u2215folder", - mAdapter.truncateHierarchy("grandparent/stuff/stuff/stuff/stuff/parent/folder")); + truncate("grandparent/stuff/stuff/stuff/stuff/parent/folder")); + } + + private String truncate(String hierarchy) { + final SpannableStringBuilder result = mAdapter.truncateHierarchy(hierarchy); + return result == null ? null : result.toString(); } } |