class RingBufferSimple extends RingBufferBase<V> {

	@Override
	public final int length() {
		return array.length;
	}

}

class TestRingBufferSimple {

	@Test
	public void testHead() {


		final RingBuffer<Integer> ring = new RingBufferSimple<Integer>(10);
		assertEquals(ring.length(), 10);

		ring.setHead(100, 100);
		assertEquals(ring.count(), 1);
		assertEquals(ring.get(100), (Integer) 100);

		for (int k = 101; k < 110; k++) {
			assertEquals(ring.get(k), null);
		}

		for (int k = 100; k < 110; k++) {
			ring.set(k, k);
		}

		assertEquals(ring.count(), 10);

		for (int k = 100; k < 110; k++) {
			assertEquals(ring.get(k), (Integer) k);
		}

		ring.setHead(105, 205);

		assertEquals(ring.count(), 5);
		assertEquals(ring.head(), 105);
		assertEquals(ring.tail(), 114);

		assertEquals(ring.get(105), (Integer) 205);

		for (int k = 106; k < 110; k++) {
			assertEquals(ring.get(k), (Integer) k);
		}

		for (int k = 110; k < 115; k++) {
			assertEquals(ring.get(k), (Integer) null);
		}

		ring.set(114, 114);

		assertEquals(ring.count(), 6);
		assertEquals(ring.get(114), (Integer) 114);

	}

}