@Test
public void purgeTillCommand() throws Exception {

	CommandBuffer buffer = new CommandBuffer(10);
	for (int i = 1; i <= 15; i++) {
		buffer.addCommand(createCmd(i));
		if (i <= 11) {
			buffer.consumeCommand();
		}
	}
	Assert.assertEquals(10, buffer.getBufferedCommandsCount());
	buffer.purgeTillCommand(8);
	Assert.assertEquals(8, buffer.getBufferedCommandsCount());
	buffer.purgeTillCommand(10);
	Assert.assertEquals(6, buffer.getBufferedCommandsCount());
	buffer.purgeTillCommand(11);
	Assert.assertEquals(5, buffer.getBufferedCommandsCount());
	buffer.purgeTillCommand(12);
	Assert.assertEquals("must not purge next consumable command", 4, buffer.getBufferedCommandsCount());
	buffer.purgeTillCommand(100);
	Assert.assertEquals("must not purge next consumable command", 4, buffer.getBufferedCommandsCount());
}