public long add(T item) {
        final long nextSequence = ringbuffer.peekNextTailSequence();
        if (store.isEnabled()) {
            try {
                store.store(nextSequence, convertToData(item));
            } catch (Exception e) {
                throw new HazelcastException(e);
            }
        }

        final long storedSequence = addInternal(item);
        if (storedSequence != nextSequence) {
            throw new IllegalStateException("Sequence we stored the item with and Ringbuffer sequence differs. Was the "
                    + "Ringbuffer mutated from multiple threads?");
        }

        return storedSequence;
    }
@Test
    public void add() {
        RingbufferConfig config = new RingbufferConfig("foo").setCapacity(10);
        RingbufferContainer<Data, Data> ringbuffer = getRingbufferContainer(config);
        ringbuffer.add(toData("foo"));
        ringbuffer.add(toData("bar"));

        assertEquals(1, ringbuffer.tailSequence());
        assertEquals(0, ringbuffer.headSequence());
    }