r.nextBytes(buf);
RandomAccessBuffer raf = construct(len);
TempRandomAccessBuffer t = (TempRandomAccessBuffer) raf;
assertFalse(t.hasMigrated());
assertEquals(factory.getRamUsed(), len);
t.migrateToDisk();
assertTrue(t.hasMigrated());
assertEquals(factory.getRamUsed(), 0);
raf.pwrite(0L, buf, 0, buf.length);
checkArrayInner(buf, raf, len, r);
raf.close();