@Test
public void testSaveState() throws Exception {

  TestSource source = new TestSource();
  MysqlSourceState savedState = mock(MysqlSourceState.class);
  MysqlSourceState newState = mock(MysqlSourceState.class);
  when(stateRepository.read()).thenReturn(savedState);
  source.saveState(newState);
  verify(stateRepository, times(1)).save(newState);
  assertEquals(newState, source.getLastSavedState().get());
}