// Validate the internal structure of the cache.
ensureCacheIntegrity(cache);
StatisticsSnapshot snapshotAfter = rootGroup.getStatisticsSnapshot();
StatisticsDelta delta = snapshotAfter.difference(snapshotBefore);
System.out.println("Period: " + delta.getPeriod());
System.out.println("Hit count: " + delta.getHitCount());
System.out.println("Missed / Added count: " + delta.getMissedAddedCount());
System.out.println("Removed count: " + delta.getRemovedCount());
System.out.println("Change count: " +
(delta.getMissedAddedCount() - delta.getRemovedCount()));
System.out.println("Hit rate: " + delta.getHitRate() + "%");
System.out.println("Key count: " + keys.size());
cache.debugStructure(new IndentingWriter(System.out));
// Make sure that the number of entries removed according to the
// snapshot is equal to the number removed according to the listener.
int notifiedRemovedCount = listener.getRemovedCount();
System.out.println("Notified removed count: " + notifiedRemovedCount);
assertEquals(delta.getRemovedCount(), notifiedRemovedCount);
if (logger.isDebugEnabled()) {
StringWriter writer = new StringWriter();
IndentingWriter printer = new IndentingWriter(writer);
cache.debugStructure(printer);