### Question:
NameIndex implements Storable<NameIndex> { @Override public void flush() { names.setHeader(0, BitUtil.LITTLE.getIntLow(bytePointer)); names.setHeader(4, BitUtil.LITTLE.getIntHigh(bytePointer)); names.flush(); } NameIndex(Directory dir); @Override NameIndex create(long initBytes); @Override boolean loadExisting(); long put(String name); String get(long pointer); @Override void flush(); @Override void close(); @Override boolean isClosed(); void setSegmentSize(int segments); @Override long getCapacity(); void copyTo(NameIndex nameIndex);  }### Answer:
@Test public void testFlush() { String location = "./target/nameindex-store"; Helper.removeDir(new File(location)); NameIndex index = new NameIndex(new RAMDirectory(location, true).create()).create(1000); long pointer = index.put("test"); index.flush(); index.close(); index = new NameIndex(new RAMDirectory(location, true)); assertTrue(index.loadExisting()); assertEquals("test", index.get(pointer)); long newPointer = index.put("testing"); assertEquals(newPointer + ">" + pointer, pointer + "test".getBytes().length + 1, newPointer); index.close(); Helper.removeDir(new File(location)); }