OffHeapByteBufferStore implements OffHeapStore { protected void nextBuffer() { bufferChangeLock.lock(); try { Integer currentBuffer = availableBuffers.poll(); if (currentBuffer == null) { throw new BufferOverflowException(); } this.currentBuffer.set(currentBuffer); } finally { bufferChangeLock.unlock(); } } 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(expected = BufferOverflowException.class) public void nextBufferBufferOverFlow() { bufferStore.availableBuffers = queue; doReturn(null).when(queue).poll(); bufferStore.nextBuffer(); verify(queue).poll(); }