@Test
	public void testOldHistoryIsDiscarded() throws CommandExecutionException {
		History<ICommand> history = new History<>(new TestHistoryStrategy(), mock(EventBus.class));
		history.setMaximumCapacity(2);
		
		ICommand cmd1 = mock(ICommand.class);
		ICommand cmd2 = mock(ICommand.class);
		ICommand cmd3 = mock(ICommand.class);
		final StringBuilder bld = new StringBuilder();
		doAnswer(new Answer<Object>() {
			@Override
			public Object answer(InvocationOnMock invocation) throws Throwable {
				bld.append("c");
				return null;
			}
		}).when(cmd3).undo();
		doAnswer(new Answer<Object>() {
			@Override
			public Object answer(InvocationOnMock invocation) throws Throwable {
				bld.append("b");
				return null;
			}
		}).when(cmd2).undo();
		doAnswer(new Answer<Object>() {
			@Override
			public Object answer(InvocationOnMock invocation) throws Throwable {
				bld.append("a");
				return null;
			}
		}).when(cmd1).undo();
		
		history.execute(cmd1);
		history.execute(cmd2);
		history.execute(cmd3);
		Assert.assertTrue(history.hasPastOperations());
		history.undo();
		history.undo();
		Assert.assertFalse(history.hasPastOperations());
		history.undo();
		Assert.assertFalse(history.hasPastOperations());
		Assert.assertEquals("cb", bld.toString());
	}