MemoryMapFileMock implements MemoryMappedFile { @Override public ByteBuffer getBuffer(int size) throws IOException { return ByteBuffer.allocate(size); }  @Override boolean exists(); @Override ByteBuffer getBuffer(int size); @Override void close();  }
@Test public void getBuffer() throws IOException { ByteBuffer buffer = memoryMappedFile.getBuffer(100); assertNotNull(buffer); assertEquals(100, buffer.remaining()); }