Author: manik.surtani(a)jboss.com
Date: 2009-02-08 06:42:01 -0500 (Sun, 08 Feb 2009)
New Revision: 7665
Modified:
core/branches/flat/src/main/java/org/horizon/container/UnsortedDataContainer.java
core/branches/flat/src/test/java/org/horizon/util/BidirectionalLinkedHashMapTest.java
Log:
Fixed broken tests
Modified:
core/branches/flat/src/main/java/org/horizon/container/UnsortedDataContainer.java
===================================================================
---
core/branches/flat/src/main/java/org/horizon/container/UnsortedDataContainer.java 2009-02-08
11:24:01 UTC (rev 7664)
+++
core/branches/flat/src/main/java/org/horizon/container/UnsortedDataContainer.java 2009-02-08
11:42:01 UTC (rev 7665)
@@ -193,9 +193,9 @@
Map.Entry<K, ExpirableCachedValue<V>> entry = iter.next();
ExpirableCachedValue<?> cv = entry.getValue();
if (cv.expired()) {
- iter.remove();
expireOnCacheLoader(entry.getKey());
purged.add(entry.getKey());
+ iter.remove();
}
}
return purged;
Modified:
core/branches/flat/src/test/java/org/horizon/util/BidirectionalLinkedHashMapTest.java
===================================================================
---
core/branches/flat/src/test/java/org/horizon/util/BidirectionalLinkedHashMapTest.java 2009-02-08
11:24:01 UTC (rev 7664)
+++
core/branches/flat/src/test/java/org/horizon/util/BidirectionalLinkedHashMapTest.java 2009-02-08
11:42:01 UTC (rev 7665)
@@ -69,13 +69,19 @@
int index = 0;
while (it.hasNext()) assert it.next() == index++;
- assert index == 999 : "Was expecting 999, was " + index;
+ assert index == 1000 : "Was expecting 1000, was " + index;
// now check the reverse iterator.
+ System.out.println("Keys: " + map.keySet());
it = map.keySet().reverseIterator();
- while (it.hasNext()) assert it.next() == index--;
+ index = 999;
+ while (it.hasNext()) {
+ int expected = index--;
+ int actual = it.next();
+ assert actual == expected : "Was expecting " + expected + " but
was " + actual;
+ }
- assert index == 0 : "Was expecting 0, was " + index;
+ assert index == -1 : "Was expecting -1, was " + index;
}