diff options
author | Vincent Breitmoser <valodim@mugenguild.com> | 2014-10-03 03:29:08 +0200 |
---|---|---|
committer | Vincent Breitmoser <valodim@mugenguild.com> | 2014-10-03 03:29:23 +0200 |
commit | a91468565ff600e082c29aec6433c51a19f26b07 (patch) | |
tree | cf362b9e8e09b6c7aa9375efc5c8fbbb0c70db9d /OpenKeychain-Test/src/test/java/org/sufficientlysecure/keychain/util | |
parent | 4b4e885e55f788bd2cf05f3c83f5a4bccb6cd0c0 (diff) | |
download | open-keychain-a91468565ff600e082c29aec6433c51a19f26b07.tar.gz open-keychain-a91468565ff600e082c29aec6433c51a19f26b07.tar.bz2 open-keychain-a91468565ff600e082c29aec6433c51a19f26b07.zip |
use iterator interface exclusively in ParcelableFileCache
Diffstat (limited to 'OpenKeychain-Test/src/test/java/org/sufficientlysecure/keychain/util')
-rw-r--r-- | OpenKeychain-Test/src/test/java/org/sufficientlysecure/keychain/util/ParcelableFileCacheTest.java | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/OpenKeychain-Test/src/test/java/org/sufficientlysecure/keychain/util/ParcelableFileCacheTest.java b/OpenKeychain-Test/src/test/java/org/sufficientlysecure/keychain/util/ParcelableFileCacheTest.java index ba9ba7369..7f473c345 100644 --- a/OpenKeychain-Test/src/test/java/org/sufficientlysecure/keychain/util/ParcelableFileCacheTest.java +++ b/OpenKeychain-Test/src/test/java/org/sufficientlysecure/keychain/util/ParcelableFileCacheTest.java @@ -29,6 +29,7 @@ import org.robolectric.RobolectricTestRunner; import org.robolectric.shadows.ShadowLog; import java.util.ArrayList; +import java.util.Iterator; import java.util.List; @RunWith(RobolectricTestRunner.class) @@ -55,16 +56,19 @@ public class ParcelableFileCacheTest { } // write to cache file - cache.writeCache(list); + cache.writeCache(list.size(), list.iterator()); // read back - List<Bundle> last = cache.readCacheIntoList(); + Iterator<Bundle> it = cache.readCache(); - for (int i = 0; i < list.size(); i++) { + Assert.assertEquals("number of entries must be correct", list.size(), cache.getNumEntries()); + + while (it.hasNext()) { + Bundle b = it.next(); Assert.assertEquals("input values should be equal to output values", - list.get(i).getInt("key1"), last.get(i).getInt("key1")); + b.getInt("key1"), b.getInt("key1")); Assert.assertEquals("input values should be equal to output values", - list.get(i).getString("key2"), last.get(i).getString("key2")); + b.getString("key2"), b.getString("key2")); } } |