CHKStore store = new CHKStore();
new RAMFreenetStore<CHKBlock>(store, 10);
// Encode a block
String test = "test";
ClientCHKBlock block = encodeBlock(test, false);
store.put(block.getBlock(), true);
ClientCHK key = block.getClientKey();
CHKBlock verify = store.fetch(key.getNodeCHK(), false, false, null);
String data = decodeBlock(verify, key);
assertEquals(test, data);
// ignoreOldBlocks works.
assertEquals(null, store.fetch(key.getNodeCHK(), false, true, null));
// Put it with oldBlock = false should unset the flag.
store.put(block.getBlock(), false);
verify = store.fetch(key.getNodeCHK(), false, true, null);
data = decodeBlock(verify, key);
assertEquals(test, data);
}