@Test
public void test() throws Exception {

  MysqlSourceState firstState = mock(MysqlSourceState.class);
  MysqlSourceState secondState = mock(MysqlSourceState.class);
  MysqlSourceState thirdState = mock(MysqlSourceState.class);
  MysqlSourceState fourthState = mock(MysqlSourceState.class);
  TestRepository repository = new TestRepository(firstState);
  StateHistory<MysqlSourceState> history =
      new StateHistory<>(SOURCE_NAME, 2, repository, metrics);
  history.add(secondState);
  assertEquals(Arrays.asList(firstState, secondState), repository.get());
  history.add(thirdState);
  history.add(fourthState);
  assertEquals(Arrays.asList(thirdState, fourthState), repository.get());
}