OffHeapByteBufferStore implements OffHeapStore { public long dirtyMemory() { long dirtyMemory = 0; for (int i = 0; i < bufferSize; i++) { dirtyMemory += buffers[i].dirtyMemory(); } return dirtyMemory; } OffHeapByteBufferStore(int capacity, int bufferSize);  OffHeapByteBufferStore(int capacity, int bufferSize, int concurrencyLevel); byte[] retrieve(Pointer pointer); byte[] remove(Pointer pointer); Pointer store(byte[] payload, long expiry); Pointer update(final Pointer pointer, final byte[] payload, final long expiry); long dirtyMemory(); long usedMemory(); long freeMemory(); void free(); void free(int bufferIndex);  }
@Test public void dirtyMemory() { long size = 100; bufferStore.buffers = new OffHeapByteBuffer[]{buffer}; doReturn(size).when(buffer).dirtyMemory(); long actualSize = bufferStore.dirtyMemory(); assertEquals(size, actualSize); }