diff options
author | Bjorn Bringert <bringert@android.com> | 2009-04-29 14:50:46 +0100 |
---|---|---|
committer | Bjorn Bringert <bringert@android.com> | 2009-04-29 14:50:46 +0100 |
commit | aece7c6723b1a227f6f57db4fde0c1bdd50acf78 (patch) | |
tree | 2a1f87f57e88fbc8bd6800d1566e412b0da4ad03 /tests | |
parent | 203464af9638e4d5aecd811452af67fff9aa3087 (diff) | |
download | frameworks_base-aece7c6723b1a227f6f57db4fde0c1bdd50acf78.zip frameworks_base-aece7c6723b1a227f6f57db4fde0c1bdd50acf78.tar.gz frameworks_base-aece7c6723b1a227f6f57db4fde0c1bdd50acf78.tar.bz2 |
Split testSearchablesMocked into two tests.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/AndroidTests/src/com/android/unit_tests/SearchablesTest.java | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/tests/AndroidTests/src/com/android/unit_tests/SearchablesTest.java b/tests/AndroidTests/src/com/android/unit_tests/SearchablesTest.java index d2eb7e7..cdbe98b 100644 --- a/tests/AndroidTests/src/com/android/unit_tests/SearchablesTest.java +++ b/tests/AndroidTests/src/com/android/unit_tests/SearchablesTest.java @@ -140,33 +140,34 @@ public class SearchablesTest extends AndroidTestCase { * getIcon works */ - public void testSearchableMocked() { + public void testSearchablesListReal() { MyMockPackageManager mockPM = new MyMockPackageManager(mContext.getPackageManager()); MyMockContext mockContext = new MyMockContext(mContext, mockPM); - Searchables searchables; - ArrayList<SearchableInfo> searchablesList; - int count; - // build item list with real-world source data mockPM.setSearchablesMode(MyMockPackageManager.SEARCHABLES_PASSTHROUGH); - searchables = new Searchables(mockContext); + Searchables searchables = new Searchables(mockContext); searchables.buildSearchableList(); // tests with "real" searchables (deprecate, this should be a unit test) - searchablesList = searchables.getSearchablesList(); - count = searchablesList.size(); + ArrayList<SearchableInfo> searchablesList = searchables.getSearchablesList(); + int count = searchablesList.size(); assertTrue(count >= 1); // this isn't really a unit test checkSearchables(searchablesList); + } + + /** + * This round of tests confirms good operations with "zero" searchables found + */ + public void testSearchablesListEmpty() { + MyMockPackageManager mockPM = new MyMockPackageManager(mContext.getPackageManager()); + MyMockContext mockContext = new MyMockContext(mContext, mockPM); - // build item list with mocked search data - // this round of tests confirms good operations with "zero" searchables found - // This should return either a null pointer or an empty list mockPM.setSearchablesMode(MyMockPackageManager.SEARCHABLES_MOCK_ZERO); - searchables = new Searchables(mockContext); + Searchables searchables = new Searchables(mockContext); searchables.buildSearchableList(); - searchablesList = searchables.getSearchablesList(); + ArrayList<SearchableInfo> searchablesList = searchables.getSearchablesList(); if (searchablesList != null) { - count = searchablesList.size(); + int count = searchablesList.size(); assertTrue(count == 0); } } |