@Test
public void testOnCommunicationError() throws Exception {

  TestSource source = new TestSource();
  source.addListener(listener);
  source.setPosition(null);
  try {
    source.onCommunicationError(new RuntimeException());
    fail("Should not reach here");
  } catch (Exception ex) {
  }
  assertNull(source.getLastSavedState().get());
  try {
    source.onCommunicationError(new InvalidBinlogPositionException(""));
    fail("Should not reach here");
  } catch (Exception ex) {
  }
  assertEquals(
      MysqlSource.EARLIEST_BINLOG_POS, source.getLastSavedState().get().getLastPosition());
}