operationProcess, "cacheArray");
assertNotNull(array);
TreeSet set = new TreeSet(new Comparator() {
public int compare(Object o1, Object o2) {
NameValuePair value1 =
(NameValuePair) o1;
NameValuePair value2 =
(NameValuePair) o2;
return value1.getName().compareTo(value2.getName());
}
});
for (int i = 0; i < array.length; i++) {
set.add(array[i]);
}
assertEquals("Set size matches", array.length, set.size());
int index = 0;
Iterator iterator = set.iterator();
while (iterator.hasNext()) {
NameValuePair o =
(NameValuePair) iterator.next();
assertTrue("Static cache is not sorted by name: " + o.getName(),
o == array[index]);
assertEquals("Static cache name is not uppercase: " + o.getName(),
o.getName().toUpperCase(),
o.getName());
assertEquals("Static cache value is not lowercase: " + o.getValue(),
o.getValue().toLowerCase(),
o.getValue());
++index;
}
}