}
}
public void testPreviousKey() {
resetEmpty();
OrderedMap ordered = (OrderedMap) map;
assertEquals(null, ordered.previousKey(getOtherKeys()[0]));
if (isAllowNullKey() == false) {
try {
assertEquals(null, ordered.previousKey(null)); // this is allowed too
} catch (NullPointerException ex) {}
} else {
assertEquals(null, ordered.previousKey(null));
}
resetFull();
ordered = (OrderedMap) map;
List list = new ArrayList(confirmed.keySet());
Collections.reverse(list);
Iterator it = list.iterator();
Object confirmedLast = it.next();
while (it.hasNext()) {
Object confirmedObject = it.next();
assertEquals(confirmedObject, ordered.previousKey(confirmedLast));
confirmedLast = confirmedObject;
}
assertEquals(null, ordered.previousKey(confirmedLast));
if (isAllowNullKey() == false) {
try {
ordered.previousKey(null);
fail();
} catch (NullPointerException ex) {}
} else {
if (isAllowNullKey() == false) {
assertEquals(null, ordered.previousKey(null));
}
}
}